Click here to Skip to main content
15,915,163 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Inheritance. Pin
Alvaro Mendez18-Dec-02 10:33
Alvaro Mendez18-Dec-02 10:33 
GeneralRe: Inheritance. Pin
WREY18-Dec-02 10:56
WREY18-Dec-02 10:56 
GeneralRe: Inheritance. Pin
Alvaro Mendez18-Dec-02 12:41
Alvaro Mendez18-Dec-02 12:41 
GeneralRe: Inheritance. Pin
WREY19-Dec-02 7:18
WREY19-Dec-02 7:18 
GeneralRe: Inheritance. Pin
Alvaro Mendez20-Dec-02 6:05
Alvaro Mendez20-Dec-02 6:05 
GeneralRe: Inheritance. Pin
WREY20-Dec-02 7:18
WREY20-Dec-02 7:18 
GeneralRe: Inheritance. Pin
Chris Richardson19-Dec-02 18:59
Chris Richardson19-Dec-02 18:59 
GeneralRe: Inheritance. Pin
WREY19-Dec-02 21:49
WREY19-Dec-02 21:49 
Thanks for your reply.

I can see your point for needing the class name and the scope resolution operator. It's needed because there are two data members with the SAME name in two different classes, and the only way you can avoid ambiguity in that situation is by specifically qualifying each data member with their respective class name followed by the scope resolution operator.

That is NOT the case in my example. In my sample, only the base class has that particular data member name (there's no ambiguity present). Moreover, the base class is instantiated through the derived class constructor initializer list.

The thing is, I can use just the protected data member name by itself (from a derived class function, even without the base class name and scope resolution operator) and it would be correct!! But if I were to try and access the base class by way of its own 'this' pointer (and qualify it as the base class through casting), suddenly, the compiler starts complaining if I were to try and access a protected member of the base class.

This is where I am. The compiler obviously isn't happy, and it's complaining. I need to know what is there in the rules of C++ that's causing the compiler to report a syntactical error (other than what it's already saying), when another part of the rule is definitely saying differently.

I don't see where I'm violating anything by using the base class 'this' pointer to access one of its protected data member from a derived class.

Maybe I'm suffering from tunnel vision here, but this is the kind of stuff that makes C++ so interesting (or frustrating)!!

Cool | :cool:

William
GeneralRe: Inheritance. Pin
Chris Richardson20-Dec-02 7:03
Chris Richardson20-Dec-02 7:03 
GeneralRe: Inheritance. Pin
WREY20-Dec-02 7:24
WREY20-Dec-02 7:24 
QuestionHow to delete an HBITMAP? Pin
Joan M18-Dec-02 9:37
professionalJoan M18-Dec-02 9:37 
AnswerRe: How to delete an HBITMAP? Pin
Christian Graus18-Dec-02 9:49
protectorChristian Graus18-Dec-02 9:49 
GeneralRe: How to delete an HBITMAP? Pin
Joan M18-Dec-02 9:59
professionalJoan M18-Dec-02 9:59 
AnswerRe: How to delete an HBITMAP? Pin
Paul M Watt18-Dec-02 9:51
mentorPaul M Watt18-Dec-02 9:51 
GeneralRe: How to delete an HBITMAP? Pin
Joan M18-Dec-02 9:59
professionalJoan M18-Dec-02 9:59 
GeneralWeird Case Pin
Sidney18-Dec-02 9:34
Sidney18-Dec-02 9:34 
GeneralRe: Weird Case Pin
Chris Richardson18-Dec-02 10:31
Chris Richardson18-Dec-02 10:31 
GeneralRe: Weird Case Pin
Sidney18-Dec-02 10:57
Sidney18-Dec-02 10:57 
GeneralRe: Weird Case Pin
Chris Richardson19-Dec-02 20:32
Chris Richardson19-Dec-02 20:32 
GeneralMFC Grid - How To Tab Out of... Pin
RFID Chris18-Dec-02 9:14
RFID Chris18-Dec-02 9:14 
GeneralReverse link list test Pin
Todd Smith18-Dec-02 8:49
Todd Smith18-Dec-02 8:49 
GeneralRe: Reverse link list test Pin
Tim Smith18-Dec-02 9:12
Tim Smith18-Dec-02 9:12 
QuestionDlls dialogs in FormViews? Pin
Ricky_TheBard18-Dec-02 8:27
Ricky_TheBard18-Dec-02 8:27 
QuestionFunctions to manage user profiles in a server ? Pin
Cris18-Dec-02 8:22
Cris18-Dec-02 8:22 
QuestionFlexible deriving a CAsyncSocket class? Pin
User 665818-Dec-02 7:56
User 665818-Dec-02 7:56 

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.