Click here to Skip to main content
15,891,766 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: WM_SHUTDOWN Notification to a dll Pin
AssemblySoft24-Nov-04 23:06
AssemblySoft24-Nov-04 23:06 
GeneralChanging font in treeview control Pin
Alpha Siera24-Nov-04 0:29
Alpha Siera24-Nov-04 0:29 
GeneralRe: Changing font in treeview control Pin
Jack Puppy24-Nov-04 0:54
Jack Puppy24-Nov-04 0:54 
GeneralMultiple row selection MSFlexGrid Pin
balajeedurai23-Nov-04 23:37
balajeedurai23-Nov-04 23:37 
Generalhelp....... Pin
namaskaaram23-Nov-04 23:13
namaskaaram23-Nov-04 23:13 
GeneralRe: help....... Pin
Jack Puppy24-Nov-04 0:45
Jack Puppy24-Nov-04 0:45 
GeneralRe: help....... Pin
namaskaaram24-Nov-04 16:57
namaskaaram24-Nov-04 16:57 
General#defining correct constant Pin
GDavy23-Nov-04 23:07
GDavy23-Nov-04 23:07 
I`ve got kind off a complex situation here.
I have a class hierarchy that looks like

class A
class aB:public A
class aC:public A
class cD:public C
with further derived classes, but for illustrating this`ll do.
in class A I define some constants like

#define CONST_A_1 1
#define CONST_A_2 2
...

if class aB needs to I should be able to define a series of constants there that continues where the series of #defines in class A stopped.
e.g. if last const in class A was #define CONST_A_X x (where x is a number)
then CONST_aB_1 should get value x+1.
Ok this is easy I could just define in class A #define CONST_A_LAST CONST_A_X
and set the definitions in class aB like

#define CONST_aB_1 (CONST_A_LAST+1)
#define CONST_aB_2 (CONST_aB_1+1)
...

Now imagine that the constants defined in A are good enough for aC(no extra needed), but I need some more for cD...
I could define them in cD as i did in aB like #define CONST_cD_1 (CONST_A_LAST+1) and so on, but what if due to specifications I don^t have yet I will need to define a constant in aC later on? Then I will need to change the defines in class cD too (at least the first one,because I don^t want a constant with the same value in base-class)....
From the start I could define in aC something like #define CONST_C_LAST CONST_A_LAST
and use that CONST_C_LAST as a starting point in cD.

However I don^t like the above approach( although it might be the only one??)
The thing is each time I would derive a new class from one of these classes I would need to remember to define a new "CONST_..._LAST" constant (in case that I derive a class from that class and need to specify a new const).Which might lead to a lot of unused defined constants (doesn^t hurt, but I don^t li

Does anybody know how I could solve this issue here in such a way that I can remove/add new constants to a class without needing to worry about derived classes of that class. Or derive classes without having to remember adding a CONST_..._LAST if I don^t need it for that class, but still be able to derive a new class from that one and start with a correct constant without bothering base class, and in case base class suddenly needs a constant adding it there without bothering derived class.

I know sounds like a lot to ask for. But someone might know a solution....
Thanks for any insight you might provide.
Greets,
Davy
QuestionCString to a int? Pin
Larsson23-Nov-04 22:55
Larsson23-Nov-04 22:55 
AnswerRe: CString to a int? Pin
Yuvaraj N23-Nov-04 22:59
Yuvaraj N23-Nov-04 22:59 
GeneralRe: CString to a int? Pin
Larsson23-Nov-04 23:01
Larsson23-Nov-04 23:01 
GeneralRe: CString to a int? Pin
Yuvaraj N23-Nov-04 23:10
Yuvaraj N23-Nov-04 23:10 
AnswerRe: CString to a int? Pin
V.23-Nov-04 23:53
professionalV.23-Nov-04 23:53 
AnswerRe: CString to a int? Pin
toxcct24-Nov-04 8:17
toxcct24-Nov-04 8:17 
GeneralRe: WM_SHUTDOWN notification Win32 dll Pin
geo_m23-Nov-04 22:45
geo_m23-Nov-04 22:45 
QuestionGIF in dialogue box? Pin
max_gundam1523-Nov-04 22:37
max_gundam1523-Nov-04 22:37 
Generalworking of up and down arrows Pin
Anonymous23-Nov-04 22:28
Anonymous23-Nov-04 22:28 
QuestionHow to overwrite ID_APP_EXIT function ? Pin
ledallam23-Nov-04 22:23
ledallam23-Nov-04 22:23 
AnswerRe: How to overwrite ID_APP_EXIT function ? Pin
Jack Puppy24-Nov-04 1:05
Jack Puppy24-Nov-04 1:05 
GeneralAdd-in development VC++ .NET 2003 Pin
Robert Bielik23-Nov-04 22:13
Robert Bielik23-Nov-04 22:13 
GeneralRe: Add-in development VC++ .NET 2003 Pin
toxcct23-Nov-04 22:35
toxcct23-Nov-04 22:35 
GeneralRe: Add-in development VC++ .NET 2003 Pin
Robert Bielik23-Nov-04 22:36
Robert Bielik23-Nov-04 22:36 
GeneralRe: Add-in development VC++ .NET 2003 Pin
toxcct23-Nov-04 22:39
toxcct23-Nov-04 22:39 
GeneralDrawing on screen Pin
Atlence23-Nov-04 22:11
Atlence23-Nov-04 22:11 
GeneralWhere to start when programming MSN Messanger. Pin
anderslundsgard23-Nov-04 22:08
anderslundsgard23-Nov-04 22:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.