Well, at least the way I understand inheritance (and I'm new to C++) is that an object would just be B1 (and A), or B2 (and A).
What I'm trying to do with this, is have different windows for a game... Like, A would be all the code for a window in general, and B1 might be a toolbar, and B2 might be a map window.
I wouldn't need toolbar code on my map, or map code on my toolbar, so when A handles a mouse click on a button, and it isn't a button that's shared between all window types, it would let B1 or B2, whichever type the object is, take over and decide what to do with it...
Main Topics
Browse All Topics





by: avinash_sahayPosted on 2000-08-13 at 20:40:03ID: 3912513
I did not understand your question clearly.
A is your window class which handles the actions on the three standard buttons. For the remaining three buttons, if B1 inherits from A, then a function in A will call will call Foobar of B1. Similarly, if B2 inherits from A, then a function in A will call Foobar of B2.
But, it seems that both B1 and B2 inherit from A! When should Foobar of B1 and when should Foobar of B2 be called? Or, should both be called one after another?