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

C / C++ / MFC

 
GeneralRe: Inheritance. Pin
WREY19-Dec-02 6:34
WREY19-Dec-02 6:34 
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 
It's not working because to the compiler, what you are trying to do is equivalent to this:

class Base
{
protected:
   int x;
};

class Derived : public Base
{
public:
   void Function()
   {
      Base b;
      b.x = 10;
   }
};


Obviously this is incorrect. And, when you tell the compiler that "this" is a "Store" pointer by casting it, you are doing the exact same thing I just showed in this example. Now, if you want to "qualify" the class to which you are referring, to remove an ambiguity, as in the following example, you should use the scope resolution operator.

class Base
{
protected:
   int x;
};

class DerivedBase : public Base
{
protected:
   double x;
};

class Derived2 : public DerivedBase
{
public:
   void Function()
   {
      Base::x = 10;
      DerivedBase::x = 10.0;
   }
};


Maybe I'm wrong, but this is how it seems to me...Smile | :)

Chris Richardson

Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
GeneralRe: Inheritance. Pin
WREY19-Dec-02 21:49
WREY19-Dec-02 21:49 
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 

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.