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

C / C++ / MFC

 
AnswerRe: How to make member functions of an application accessible by a DLL? Pin
MANISH RASTOGI4-Aug-11 2:51
MANISH RASTOGI4-Aug-11 2:51 
Question/clr:pure question Pin
WebDev.ChrisG2-Aug-11 5:01
WebDev.ChrisG2-Aug-11 5:01 
AnswerRe: /clr:pure question Pin
Rolf Kristensen2-Aug-11 12:47
Rolf Kristensen2-Aug-11 12:47 
GeneralRe: /clr:pure question Pin
WebDev.ChrisG4-Aug-11 11:22
WebDev.ChrisG4-Aug-11 11:22 
QuestionIs it possible to use a different theme only for my app Pin
Cold_Fearing_Bird2-Aug-11 0:13
Cold_Fearing_Bird2-Aug-11 0:13 
AnswerRe: Is it possible to use a different theme only for my app Pin
Nemanja Trifunovic2-Aug-11 4:19
Nemanja Trifunovic2-Aug-11 4:19 
SuggestionRe: Is it possible to use a different theme only for my app PinPopular
Charles Oppermann2-Aug-11 19:54
Charles Oppermann2-Aug-11 19:54 
Questionvirtual inheritance and polymorphism! [modified] Pin
Dean Seo1-Aug-11 20:03
Dean Seo1-Aug-11 20:03 
Since I found this site, it has helped me improve my skills a lot.

I used to ask about MFC but now I need to know the relevancy between virtual inheritance and polymorphism.
I tried to find it in Google, but I couldn't find what I'd like to know.
Maybe I think it's because virtual inheritence is only used for multiple inheritance, which is considered bad to use.

For example, it seems like there is no way to keep polymorphism the way I think it has to be in multiple and virtual inheritance, as you see below.

C++
class A{};
class B : public A{};
class C : public A{};
class D : public B, public C{};
int _tmain(int argc, _TCHAR* argv[])
{	
	A* a = new D();   // compile error!
}

This seems like a very reasonable compile error to me but why?
Is it not an IS-A relationship? I'd like to thoroughly understand this.

Also, as you can see in the code below,
C++
class A{};
class B : public A{};
class C : public A{};
class D : public B, public C{};
int _tmain(int argc, _TCHAR* argv[])
{	
	B* b = new D();  // works! ..what?
}

If A and D are not an IS-A relationship, why does B and D have to be an IS-A relationship?

Or something like this.
C++
class A{};
class B : public A{};
class C : public A{
public:
	virtual void Func(){
		cout << "Called??";
	}
};
class D : public B, public C{
public:
	virtual void Func(){
		cout << "Called!!";
	}
};
int _tmain(int argc, _TCHAR* argv[])
{	
	B* b = new D();
	b->Func();   // Error!
}


I understand that I can figure out how this works, but since it's a pretty complicated thing, I'd like to know why this happens, THROUGHLY.

So I'd like to know where on the internet web pages I can figure all this out so that I can sleep tight!

Thanks in advance.

modified on Tuesday, August 2, 2011 2:13 AM

AnswerRe: virtual inheritance and polymorphism! Pin
Peter_in_27801-Aug-11 20:36
professionalPeter_in_27801-Aug-11 20:36 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:20
Dean Seo3-Aug-11 16:20 
AnswerRe: virtual inheritance and polymorphism! Pin
QuickDeveloper1-Aug-11 21:35
QuickDeveloper1-Aug-11 21:35 
GeneralRe: virtual inheritance and polymorphism! Pin
Emilio Garavaglia2-Aug-11 20:21
Emilio Garavaglia2-Aug-11 20:21 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:23
Dean Seo3-Aug-11 16:23 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:23
Dean Seo3-Aug-11 16:23 
AnswerRe: virtual inheritance and polymorphism! Pin
Chandrasekharan P1-Aug-11 22:03
Chandrasekharan P1-Aug-11 22:03 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:23
Dean Seo3-Aug-11 16:23 
AnswerRe: virtual inheritance and polymorphism! Pin
Resmi Anna1-Aug-11 23:04
Resmi Anna1-Aug-11 23:04 
GeneralRe: virtual inheritance and polymorphism! Pin
Emilio Garavaglia2-Aug-11 20:30
Emilio Garavaglia2-Aug-11 20:30 
GeneralRe: virtual inheritance and polymorphism! Pin
Dean Seo3-Aug-11 16:24
Dean Seo3-Aug-11 16:24 
QuestionHow to disable a checkbox created using MFCRibbonCheckBox? Pin
MeghaJoshi1-Aug-11 18:22
MeghaJoshi1-Aug-11 18:22 
AnswerRe: How to disable a checkbox created using MFCRibbonCheckBox? Pin
Dr.Walt Fair, PE1-Aug-11 18:51
professionalDr.Walt Fair, PE1-Aug-11 18:51 
AnswerRe: How to disable a checkbox created using MFCRibbonCheckBox? Pin
Code-o-mat2-Aug-11 3:07
Code-o-mat2-Aug-11 3:07 
QuestionValue of an object in visual studio Pin
AndrewG12311-Aug-11 13:34
AndrewG12311-Aug-11 13:34 
AnswerRe: Value of an object in visual studio Pin
Richard Andrew x641-Aug-11 13:48
professionalRichard Andrew x641-Aug-11 13:48 
QuestionCreateNamedPipe() Pin
Member 38520241-Aug-11 12:36
Member 38520241-Aug-11 12:36 

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.