Click here to Skip to main content
15,887,477 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getattributename and value of an Xml Node... Pin
siva45514-Jun-09 21:39
siva45514-Jun-09 21:39 
GeneralRe: Getattributename and value of an Xml Node... Pin
«_Superman_»14-Jun-09 22:25
professional«_Superman_»14-Jun-09 22:25 
GeneralRe: Getattributename and value of an Xml Node... Pin
siva45514-Jun-09 22:32
siva45514-Jun-09 22:32 
GeneralRe: Getattributename and value of an Xml Node... Pin
«_Superman_»14-Jun-09 22:41
professional«_Superman_»14-Jun-09 22:41 
GeneralRe: Getattributename and value of an Xml Node... Pin
Stuart Dootson14-Jun-09 23:22
professionalStuart Dootson14-Jun-09 23:22 
QuestionMerge Xml [modified] Pin
p_196014-Jun-09 20:40
p_196014-Jun-09 20:40 
AnswerRe: Merge Xml Pin
Stuart Dootson14-Jun-09 23:29
professionalStuart Dootson14-Jun-09 23:29 
QuestionMultiple Inheritance doubt Pin
chirag_chauhan14-Jun-09 20:26
chirag_chauhan14-Jun-09 20:26 
My code snippet is something like this one,

class Base1
{
public:
Base1()
{
cout<<"Base1()"<<endl;
}
virtual void method()
{
cout<<"Base1::method()"<<endl;
}
};

class Base2
{
public:
Base2()
{
cout<<"Base2()"<<endl;
}
virtual void method()
{
cout<<"Base2::method()"<<endl;
}
};

class Derived:public Base1, public Base2
{
public:
Derived()
{
cout<<"Derived()"<<endl;
}
void method()
{
cout<<"Derived::method()"<<endl;
}
};

int _tmain(int argc, _TCHAR* argv[])
{
// Derived *d = static_cast<Derived *>(new Base1); // works fine

// application crash at Base2::method call, even though Base2() constructor is invoked
Derived *d = static_cast<Derived *>(new Base2);

d->method();
return 0;
}

With Base1, application works fine. But when I try to use Base2, application crashes at method() call.

And if I change the sequence in Derived class declaration to...

class Derived:public Base2, public Base1

then Base2 object works perfectly but Base1 crashes.

So, my question is why up-casting (or down-casting, not sure about specific word) works only with primary base class and not with secondary base classes??
AnswerRe: Multiple Inheritance doubt Pin
Mahesh Kulkarni14-Jun-09 20:55
Mahesh Kulkarni14-Jun-09 20:55 
AnswerRe: Multiple Inheritance doubt Pin
Cedric Moonen14-Jun-09 20:58
Cedric Moonen14-Jun-09 20:58 
GeneralRe: Multiple Inheritance doubt Pin
chirag_chauhan14-Jun-09 23:03
chirag_chauhan14-Jun-09 23:03 
Questiontext search Pin
ali kanju14-Jun-09 19:59
ali kanju14-Jun-09 19:59 
AnswerRe: text search Pin
Mahesh Kulkarni14-Jun-09 20:18
Mahesh Kulkarni14-Jun-09 20:18 
GeneralRe: text search Pin
ali kanju14-Jun-09 20:27
ali kanju14-Jun-09 20:27 
GeneralRe: text search Pin
Cedric Moonen14-Jun-09 21:08
Cedric Moonen14-Jun-09 21:08 
AnswerRe: text search Pin
_AnsHUMAN_ 14-Jun-09 20:25
_AnsHUMAN_ 14-Jun-09 20:25 
AnswerRe: text search Pin
«_Superman_»14-Jun-09 21:59
professional«_Superman_»14-Jun-09 21:59 
AnswerRe: text search Pin
David Crow15-Jun-09 2:55
David Crow15-Jun-09 2:55 
QuestionHow can change product original exe name ? Pin
Le@rner14-Jun-09 19:57
Le@rner14-Jun-09 19:57 
AnswerRe: How can change product original exe name ? Pin
Mahesh Kulkarni14-Jun-09 20:14
Mahesh Kulkarni14-Jun-09 20:14 
GeneralRe: How can change product original exe name ? Pin
Le@rner14-Jun-09 20:22
Le@rner14-Jun-09 20:22 
Questionread video stream from IP address assign to Avtech 4 channel MPEG4 DVR using C, C++, MFC Pin
kunal.tawde14-Jun-09 19:49
kunal.tawde14-Jun-09 19:49 
Questionfont problem Pin
trioum14-Jun-09 19:48
trioum14-Jun-09 19:48 
AnswerRe: font problem Pin
CPallini14-Jun-09 21:51
mveCPallini14-Jun-09 21:51 
AnswerRe: font problem Pin
«_Superman_»14-Jun-09 21:52
professional«_Superman_»14-Jun-09 21:52 

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.