GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 19-Oct-2007, 19:28
lyan lyan is offline
New Member
 
Join Date: Oct 2007
Posts: 3
lyan is on a distinguished road

Is it legal to derive from a class that inherits multiple classes?


I am having trouble to create a MFC class that is a subclass of a class with multiple inheritance. I am wondering if MFC supports this? Here is the scenario:
Class A derives from CObject
Class B derives from CDialog
Class C derives from B and A
(so far so good, Class C works fine)
Class D derives from C
(In runtime, I got following message when OK button on object of class D is clicked)

Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one ...

BTW, each derived class has DECLARE_DYNAMIC macro in header file
  #2  
Old 22-Oct-2007, 17:41
lyan lyan is offline
New Member
 
Join Date: Oct 2007
Posts: 3
lyan is on a distinguished road

Re: Is it legal to derive from a class that inherits multiple classes?


Let me answer the question myself.
Yes, I have run a test and proved it is ok to derive from a class that inherits multiple classes.
  #3  
Old 22-Oct-2007, 19:03
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Is it legal to derive from a class that inherits multiple classes?


So what caused the error with ESP? I didn't want to respond without also knowing what might have been causing the problem.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #4  
Old 23-Oct-2007, 00:27
lyan lyan is offline
New Member
 
Join Date: Oct 2007
Posts: 3
lyan is on a distinguished road

Re: Is it legal to derive from a class that inherits multiple classes?


Error was caused by wrong type of argument. It has nothing to do with inheritance.
  #5  
Old 26-Oct-2007, 03:15
Peter_APIIT Peter_APIIT is offline
Regular Member
 
Join Date: May 2007
Location: Malaysia
Posts: 545
Peter_APIIT can only hope to improve

Re: Is it legal to derive from a class that inherits multiple classes?


CObject CDialog
| |
A B
\ /
C
|
D

class A & B : public virtual CObject & CDialog.

I hope this help.
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classes and allocating memory BlueFireCO. C++ Forum 13 26-Jul-2007 20:31
Hard drive/CPU Diagnoses Issues binarybug Computer Hardware Forum 1 22-Jan-2007 19:23
Message Class TransformedBG C++ Forum 5 29-Nov-2006 21:28
Box Class, need help again :( TransformedBG C++ Forum 7 13-Nov-2006 15:11
a tester class and then some. postage Java Forum 1 06-May-2006 15:48

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 10:41.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.