I'm trying to make a base game object class that will be inherited by all other game objects. In this base class I'd like to have functions for getting the object's name, etc, etc.
Please take a look at the following short bit of code:
As you can see, the field called "Name" isn't inherited like methods are.
Is there some how I can inherit fields?
My point in doing this is so I can typecast any game object to a TGameObject (my base class) and get the objects REAL name.
I don't want to have GetName()/SetName() methods in every single object I create. (...because I want to also have a field called "ID" and other fields I'd like to "inherit")
Any help is appriciated!
Please take a look at the following short bit of code:
Type Test1 Field Name : String = "Test1 type!" Method GetName : String() Return Name End Method End Type Type Test2 Extends Test1 Field Name : String = "Test2 type! Alright!" End Type Local MyObj : Test1 = New Test2 Print a.GetName() ' displays "Test1 type!" Print a.Name ' displays "Test1 type!"
As you can see, the field called "Name" isn't inherited like methods are.
Is there some how I can inherit fields?
My point in doing this is so I can typecast any game object to a TGameObject (my base class) and get the objects REAL name.
I don't want to have GetName()/SetName() methods in every single object I create. (...because I want to also have a field called "ID" and other fields I'd like to "inherit")
Any help is appriciated!