Click here to Skip to main content
15,914,416 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Threads problem ... Pin
Stephane Rodriguez.13-Oct-02 5:36
Stephane Rodriguez.13-Oct-02 5:36 
GeneralRe: Threads problem ... Pin
BlackKettle13-Oct-02 6:43
BlackKettle13-Oct-02 6:43 
GeneralRe: Threads problem ... Pin
Al Giv.13-Oct-02 7:08
sussAl Giv.13-Oct-02 7:08 
GeneralShare variable into DLL Pin
Raphael Kindt13-Oct-02 5:06
Raphael Kindt13-Oct-02 5:06 
GeneralRe: Share variable into DLL Pin
Stephane Rodriguez.13-Oct-02 5:40
Stephane Rodriguez.13-Oct-02 5:40 
GeneralRe: Share variable into DLL Pin
Joaquín M López Muñoz13-Oct-02 8:48
Joaquín M López Muñoz13-Oct-02 8:48 
GeneralDumb question... Copying derived class from base class pointer Pin
work_to_live13-Oct-02 3:44
work_to_live13-Oct-02 3:44 
GeneralRe: Dumb question... Copying derived class from base class pointer Pin
Nish Nishant13-Oct-02 4:18
sitebuilderNish Nishant13-Oct-02 4:18 
Hmmm

I couldn't reproduce your problem (I am using VC++.NET)

class B
{
public:
    B()
    {
        a=100;
    }
    int a;
};

class D : public B
{
public:
    D()
    {
        b=200;
    }
    int b;
};

int _tmain(void)
{
    //Create derived object and assign it to base variable
    B* b1 = new D();
    //copy object in base variable to another base variable
    B* b2 = b1;
    //copy copied base variable to derived variable
    D* d = static_cast<D*>(b2);
    //try accessing a member available only in D
    printf("%d",d->b);    
    //worked fine - printed 200 as expected
    delete b1;
    return 0;
}


Regards,
Nish


Author of the romantic comedy

Summer Love and Some more Cricket [New Win]

Review by Shog9
Click here for review[NW]

GeneralRe: Dumb question... Copying derived class from base class pointer Pin
Nish Nishant13-Oct-02 4:23
sitebuilderNish Nishant13-Oct-02 4:23 
GeneralRe: Dumb question... Copying derived class from base class pointer Pin
Joaquín M López Muñoz13-Oct-02 4:29
Joaquín M López Muñoz13-Oct-02 4:29 
GeneralMySQL Inserting data Pin
Anonymous13-Oct-02 3:20
Anonymous13-Oct-02 3:20 
GeneralRe: MySQL Inserting data Pin
Nish Nishant13-Oct-02 3:31
sitebuilderNish Nishant13-Oct-02 3:31 
GeneralRe: MySQL Inserting data Pin
Anonymous13-Oct-02 10:45
Anonymous13-Oct-02 10:45 
GeneralGetting DNS Server IP Pin
Al Giv.13-Oct-02 0:19
sussAl Giv.13-Oct-02 0:19 
GeneralRe: Getting DNS Server IP Pin
Anders Molin13-Oct-02 0:29
professionalAnders Molin13-Oct-02 0:29 
GeneralQuery about how to pass a control's Identification through its Message parameters Pin
12-Oct-02 22:17
suss12-Oct-02 22:17 
GeneralA beginner's confusion. Pin
zhoujun12-Oct-02 21:33
zhoujun12-Oct-02 21:33 
GeneralRe: A beginner's confusion. Pin
Shog912-Oct-02 21:38
sitebuilderShog912-Oct-02 21:38 
GeneralRe: A beginner's confusion. Pin
zhoujun12-Oct-02 22:00
zhoujun12-Oct-02 22:00 
GeneralRe: A beginner's confusion. Pin
Shog913-Oct-02 5:08
sitebuilderShog913-Oct-02 5:08 
GeneralRe: A beginner's confusion. Pin
Joaquín M López Muñoz13-Oct-02 4:34
Joaquín M López Muñoz13-Oct-02 4:34 
GeneralRe: A beginner's confusion. Pin
Shog913-Oct-02 5:09
sitebuilderShog913-Oct-02 5:09 
GeneralUrlEscape Error Pin
John Bosko12-Oct-02 21:04
John Bosko12-Oct-02 21:04 
GeneralRe: UrlEscape Error Pin
Stephane Rodriguez.12-Oct-02 21:33
Stephane Rodriguez.12-Oct-02 21:33 
GeneralRe: UrlEscape Error Pin
Dominik Reichl13-Oct-02 1:45
Dominik Reichl13-Oct-02 1:45 

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.