Raymond
Demo: Green Dragon

Articles with the tag: Inheritance

Framework development: Composition versus Inheritance

Speed of calls

Tutorial framework's SceneNode object inherits from Mesh, Texture and other objects. This intuitively seems like a bad idea as one has to make sure different classes don't share member names.

It should speed things up, though, as it doesn't have to make pointer calls to owned Material object.

Solution: elements contain local non-pointer Material object member and copy the passed Material's data.

element->set_material(material);

This can then be called from inside the game loop for real-time material changes.

This does make objects larger, however, whereas before they would simply contain a reference to the same material object and could be all changed by changing the material. This way they'd all have to be set individually.

Composition versus Inheritance

Apparently inheritance of implementation-only things is bad, and composition should be used.

i.e. TestWorld invokes GameEngine object. Is this composition, and is ...

Read More »


Exception handling: C++ STL

Attempt to create an inherited exceptions class... the advantage seems to be that you can lump everything into one std::exception catch and use try throughout.

[29/01/14 20:53]

OK, done an exception thingy. Should use templates to allow C-style strings and other things.

[29/01/14 20:54]

Wait, no I don't, I can just use overloading...

Read More »


Page 1 / 1