What does Ben mean by "Inheritance or component"? How would we do this without a component?

I like to try and make sense of everything we learn, that includes knowing the meaning of all the words in the C++ glossary - but Inheritance and Component in this context just make no sense to me…

What is a component? Is ‘OpenDoor’ a component? Is mayonnaise an instrument?

If that’s the case, how would ‘inheritance’ allow us to grab anything?

I’m either totally missing something here, or overthinking it again. Likely both.

If I’m right in assuming ‘OpenDoor’ and ‘PositionReport’ are ‘components’, then how would we even move any actors without a component?

My understanding: It is the differences between “is a” and “has a”.

If we wanted to do it without a component, then we would write a class “Grabbable object”, and make it an actor. Then, we would write a “chair” class that is a specialized type of grabbable object, and then we would take the chair, and make it a “chair”.

Of course, that sounds like a lot of work, so I say we just use components.

I think the difference is whether we want to build our own standalone class to handle all the grabbing (that would be a new component) or whether we extend current behavior by extending an existing class (inheritance).

It probably would have made more sense if the component had been called DoorOpener.

Then you could say “This door has a door opener”.

Perhaps DoorOpen is an component, as it add more functionality to the Door. Also, Door is an actor which has all functionalities of an actor, so that’s why we can use a variety of AActor classes.

The classes we made:, OpenDoor, Grabber, PositionReport, are all components. Components are classes that can be added to Actors in the Editor to give them abilities or additional qualities. Those three component classes inherited from the UActorComponent class in order to give them the component framework that we are just adding a little bit on to. As JerryRebellion was saying… An actor has a component (added to it) and that component is a (child of) UActorComponent .

Privacy & Terms