Why no brackets on PhysicsHandle->GrabbedComponent

Here’s a question – in most cases we need to call a method to get an object to return which means most statements end with methods which have brackets. ie Instance->method()

So – why does GrabbedComponent in the statement PhysicsHandle->GrabbedComponent not use brackets? ie:

if (PhysicsHandle->GrabbedComponent)

And is there a way to tell whether or not to use the method brackets.

Hi,
Because GrabbedComponent in this case is a public variable not a method. So you cant call it. This is the actual thing a Getter method may return.

Hope thats clear?

Makes sense. Thanks.

If you’re using Visual Studio you can click on “GrabbedComponent” and it will highlight it. Then if you right click and select “Peek Definition” you will be able to see this. If you do this then you will also notice that it’s a pointer and that it’s basically the same thing he did with " if ( HitActor ) { } "

Privacy & Terms