oop question

Started by
20 comments, last by phil67rpg 10 years, 6 months ago

Well the public interface should maintain the invariant of the class. Non-public methods can do what they like though since they are only used to implement the public interface.

If you must break an invariant you probably want a class that wraps the badly behaved class. (e.g. say we have a requirement you need to call BeginFrame before Draw calls and EndFrame afterwards, you would probably assert in debug mode that the calls are made in the correct order and then wrap the whole lot in a SceneRender class). Simple example off the top of my head...

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
Advertisement

wow what a response, thanks for all the input.

This topic is closed to new replies.

Advertisement