Why does FindCreativeObjectsWithTag return the creative_object_interface?

Hi.
I am just trying to understand why FindCreativeObjectsWithTag returns a creative_object_interface and not the base class of creative_object. I see that creative_object inherits from the creative_object_interface, which is positional, and I think I understand that.

But I don’t understand why the interface is returned and that through the interface a cast can be sent to other classes such as creative_device, which share the same interface.

If two classes share an interface, does that bridge them too somehow? Is it that the interface serves as some type of conduit or portal which enables classes to communicate or cast to one another? The way it seems to be working in Verse is that two classes sharing a common interface can also use that interface as a way to cast and connect to one another. Is that correct? Is it that the Find method acquires an object’s position in the game and that is what uniquely ties the creative_object class to whichever subclass is associated with it?

I understood interfaces to be like contracts where classes agree to use a set of unimplemented methods but the interface is not connecting one class to another. The interface was between the class and interface, not between the classes sharing the interface. So I am just not understanding why the interface is returned and not the base class. That’s all.

Any thoughts appreciated.

Objects which share an interface have both inherited from the same parent interface. (creative_object, creative_device)

You can take a Child class and make a Parent reference to it, which will “mask off” all of the child parts, allowing it to be referenced as though it were the Parent class.
(FindCreativeObjectsWithTag => creative_object_interface)

You can then take this reference and cast it back into the child class, removing the “masks”. (casted_object := creative_object[creative_object_interface])

So classes which share an interface are only connected in the sense that they share a common ancestor in the class heirarchy, and cannot be converted into eachother.

1 Like

Thanks. This makes it make sense.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.