|
-
January 5th, 2009, 02:29 PM
#1
I want a class between CDialog and CMyDialog with common code but How?
I have several dialog classes which has a lot of common data but has differences in how each class handles the data. Now I want this common data to be defined in one parent class so each class doesn't have its own individual members but how can I do that given a dialog class is derived from CDialog in the first place? Is there any neat way other than multiple inheritance? I have never seen multiple inheritance used in any code and is discouraged by books..is that so?
My situation is very simple to below but that member variables are a lot and more complicated:
Suppose you have 4 dialogs each has its two integer member variables. The first one divides them, the 2nd on subtracts, the third multiply and 4th divides. Now I would want a base class which contain the two numbers that each class operates on but how do I define such a class so that I can derive each final dialog class from it? This will ideally sit between CDialog and CMyDialog in hierarchy but how to define it? All dialogs are direct derivatives of CDialog!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|