Extending and Over-Riding

Hello everyone,

I am making a physics based puzzle game and have designed the levels using XML the structure of the Level Design is as follows …

BaseObjectClass -> This class makes the objects for the game.

LevelClass -> This class extends the BaseObjectClass reads from the XML and makes the object by calling functions defined inside the BaseObjectClass

My problem is that … If suppose sometimes I don’t wanna use the Default Image that i have mentioned in the BaseObjectClass and want to use the Image whose location I have provided in the XML file how can i do that ?
(suppose I have an Orange Colored Square as the default square and I want to create 2 exactly same squares but just Red in color … how can i do that)

Any advice would be appreciated …
Thanks a lot :slight_smile:
Have a nice day

You can add a setColor(Color) method to BaseObjectClass.

thanx but that was just an example …

actually I want to use different images …

Like a Brick Shaped Image when i dont mention anything in the XML
and a maybe Mettalic Shine Image when i mention something like ‘meta’ in the XML …

Then the BaseObjectClass should have an Image variable and the code that parses the XML should be able to assign the correct image.

thanx a lot :slight_smile:
I dont know why I was confused but you sure helped :smiley: