Click here to Skip to main content
15,900,676 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Firefox Address Pin
«_Superman_»26-Aug-13 20:00
professional«_Superman_»26-Aug-13 20:00 
GeneralRe: Firefox Address Pin
MrDooDoo28-Aug-13 6:06
MrDooDoo28-Aug-13 6:06 
AnswerRe: Firefox Address Pin
Maximilien27-Aug-13 3:44
Maximilien27-Aug-13 3:44 
GeneralRe: Firefox Address Pin
MrDooDoo28-Aug-13 6:02
MrDooDoo28-Aug-13 6:02 
QuestionIs the Parent Instance Same For All Childs? Pin
AmbiguousName25-Aug-13 9:31
AmbiguousName25-Aug-13 9:31 
AnswerRe: Is the Parent Instance Same For All Childs? Pin
Richard Andrew x6425-Aug-13 10:53
professionalRichard Andrew x6425-Aug-13 10:53 
AnswerRe: Is the Parent Instance Same For All Childs? Pin
SaqibRasheed25-Aug-13 11:33
SaqibRasheed25-Aug-13 11:33 
AnswerRe: Is the Parent Instance Same For All Childs? Pin
«_Superman_»25-Aug-13 20:37
professional«_Superman_»25-Aug-13 20:37 
An instance of a class is created when memory is allocated for the class.
In the code that you've shown, there is no instance created and no memory allocated.

Refer to the code snippet below -
class BaseClass
{
  int base;
};
 
class ChildOne : public BaseClass
{
  int childOne;
  public ChildOne(){} // base class constructor also called here
};
 
Class ChildTwo : public BaseClass
{
  int childTwo;
  public ChildTwo(){}  // base class constructor also called here
};

When an object of ChildOne is created, memory is allocated for int base; and int childOne;
When an object of ChildTwo is created, memory is allocated for int base; and int childTwo;
Here you can see that memory for int base; has been allocated twice, once for the instance of ChildOne and once for the instance of ChildTwo.
So base has separate memory and hence value for each instance.
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

QuestionCreateDIBSection() is failing Pin
ash_hdr24-Aug-13 17:56
ash_hdr24-Aug-13 17:56 
SuggestionRe: CreateDIBSection() is failing Pin
Richard MacCutchan24-Aug-13 21:26
mveRichard MacCutchan24-Aug-13 21:26 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 0:15
ash_hdr25-Aug-13 0:15 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 0:45
mveRichard MacCutchan25-Aug-13 0:45 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 1:27
ash_hdr25-Aug-13 1:27 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 1:33
ash_hdr25-Aug-13 1:33 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 1:39
mveRichard MacCutchan25-Aug-13 1:39 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 2:05
ash_hdr25-Aug-13 2:05 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 2:45
mveRichard MacCutchan25-Aug-13 2:45 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 3:13
ash_hdr25-Aug-13 3:13 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 3:25
mveRichard MacCutchan25-Aug-13 3:25 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 1:37
mveRichard MacCutchan25-Aug-13 1:37 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 2:00
ash_hdr25-Aug-13 2:00 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 2:41
mveRichard MacCutchan25-Aug-13 2:41 
GeneralRe: CreateDIBSection() is failing Pin
ash_hdr25-Aug-13 2:48
ash_hdr25-Aug-13 2:48 
GeneralRe: CreateDIBSection() is failing Pin
Richard MacCutchan25-Aug-13 2:51
mveRichard MacCutchan25-Aug-13 2:51 
GeneralRe: CreateDIBSection() is failing Pin
pasztorpisti25-Aug-13 2:13
pasztorpisti25-Aug-13 2:13 

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.