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

C / C++ / MFC

 
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor9-Mar-04 20:35
vgrigor9-Mar-04 20:35 
GeneralRe: How to declare class Member with template declaration ? Pin
Robert A. T. Káldy9-Mar-04 23:52
Robert A. T. Káldy9-Mar-04 23:52 
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor10-Mar-04 0:14
vgrigor10-Mar-04 0:14 
GeneralRe: How to declare class Member with template declaration ? Pin
Antti Keskinen9-Mar-04 6:48
Antti Keskinen9-Mar-04 6:48 
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor9-Mar-04 20:40
vgrigor9-Mar-04 20:40 
GeneralRe: How to declare class Member with template declaration ? Pin
Antti Keskinen9-Mar-04 7:31
Antti Keskinen9-Mar-04 7:31 
GeneralRe: How to declare class Member with template declaration ? Pin
Michael Dunn9-Mar-04 13:10
sitebuilderMichael Dunn9-Mar-04 13:10 
GeneralRe: How to declare class Member with template declaration ? Pin
Antti Keskinen9-Mar-04 20:28
Antti Keskinen9-Mar-04 20:28 
Virtual functions are primarily, as far as I know, made so that you can create functions in the base class that can be safely overridden in a derived class if necessary. What we are doing here is creating a base class that is specifically meant for a certain derived class.

If you have a set of get/set function pairs in the base class, you can have only a limited type of derived classes, which follow the guidelines set by the base class. This, by itself, can be considered a breach, as C++ inheritance rules (at least in my book) says that inheritance should be available for all types of derived classes, not just specific ones. In our case, the layout of the base class already dictates some functionalities that must be implemented in the derived class in order for the class hiearchy to compile properly.

Here, the base class has a set of functions that can be used to set and change certain derived-class variables. This type of behaviour, as far as I know, is 'illegal', as if it was supposed to be possible to alter derived class variables directly, the inheritance, by itself, should already allow this. The idea of interfaces (pure abstract base class) used with COM technologies follows the same principles as I have outlined here. I am not saying that COM was illegal, though.

I won't start wrestling about this issue any more than that. In conclusion, it could be said that this is a taste issue: some people think it is 'illegal' while some people think it is completely good and well. It all comes down on what you are trying to accomplish, I guess. I, for myself, see no reason on why you should be able to tamper with derived class members from the base class. Perhaps this is because I have never needed this type of functionality Smile | :)

-Antti Keskinen

----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor9-Mar-04 20:47
vgrigor9-Mar-04 20:47 
GeneralRe: How to declare class Member with template declaration ? Pin
Robert A. T. Káldy9-Mar-04 23:38
Robert A. T. Káldy9-Mar-04 23:38 
GeneralRe: How to declare class Member with template declaration ? Pin
Antti Keskinen10-Mar-04 0:28
Antti Keskinen10-Mar-04 0:28 
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor9-Mar-04 20:52
vgrigor9-Mar-04 20:52 
GeneralRe: How to declare class Member with template declaration ? Pin
Michael Dunn10-Mar-04 3:56
sitebuilderMichael Dunn10-Mar-04 3:56 
GeneralRe: How to declare class Member with template declaration ? Pin
vgrigor10-Mar-04 5:34
vgrigor10-Mar-04 5:34 
GeneralFailed to Create Empty Document Pin
dotbomb9-Mar-04 4:02
dotbomb9-Mar-04 4:02 
GeneralRe: Failed to Create Empty Document Pin
Iain Clarke, Warrior Programmer9-Mar-04 4:46
Iain Clarke, Warrior Programmer9-Mar-04 4:46 
GeneralRe: Failed to Create Empty Document Pin
dotbomb11-Mar-04 5:13
dotbomb11-Mar-04 5:13 
GeneralRe: Failed to Create Empty Document Pin
Iain Clarke, Warrior Programmer11-Mar-04 5:33
Iain Clarke, Warrior Programmer11-Mar-04 5:33 
QuestionHow to change font of Cdialog programmatically ? Pin
vgrigor9-Mar-04 3:46
vgrigor9-Mar-04 3:46 
AnswerRe: How to change font of Cdialog programmatically ? Pin
David Crow9-Mar-04 4:01
David Crow9-Mar-04 4:01 
GeneralRe: How to change font of Cdialog programmatically ? Pin
vgrigor9-Mar-04 4:06
vgrigor9-Mar-04 4:06 
GeneralRe: How to change font of Cdialog programmatically ? Pin
David Crow9-Mar-04 4:21
David Crow9-Mar-04 4:21 
GeneralRe: How to change font of Cdialog programmatically ? Pin
vgrigor9-Mar-04 4:29
vgrigor9-Mar-04 4:29 
GeneralRe: How to change font of Cdialog programmatically ? Pin
vgrigor9-Mar-04 5:57
vgrigor9-Mar-04 5:57 
GeneralRe: How to change font of Cdialog programmatically ? Pin
win32newb11-Mar-04 21:22
susswin32newb11-Mar-04 21:22 

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.