destructor problems
From: James Connell (jconnell_at_gci.net)
Date: 03/31/04
- Next message: Leor Zolman: "Re: Logic in equality and assignment"
- Previous message: Grumble: "Re: [C] whats the difference between "char" and "Char" ?"
- Next in thread: Leor Zolman: "Re: destructor problems"
- Reply: Leor Zolman: "Re: destructor problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 31 Mar 2004 06:35:22 -0900
Hi guys,
just as i thought i was gettng a handle on c++ this pops up.
i'm working on a project that derives a class from a base class ( it's
an aftermarket lib so i only have the headers to work with). oin the new
class i need at add a couple pointers to a couple of other classes in
the lib and , if needed, create them with 'new'. now it's my
understanding that i'll need to destroy these in the destructor for my
class. and there's the rub - i can't declare a destructor for myclass ?!?
i keep getting and error - Virtual function 'TMyClass::~TMyClass()'
confilts with base class 'TAncestor'.
inline virtual ~TAncestor(void) { }
is the base destructor, and my Dtor is
TMyClass::~TMyClass(void)
{
if(BitMap) delete BitMap;
if(Control) delete Control;
}
Ctors are
virtual TAncestor(TBaseAncestor* x);
TMyClass::TMyClass() : TAncestor(NULL),Control(NULL),
FState(NORMAL),BitMap(NULL)
{
}
ive never had a problem useing null for the base of Ancestor any other
time ( but i haven't inherited from this base before) but could that be
causeing the grief?
--JC
- Next message: Leor Zolman: "Re: Logic in equality and assignment"
- Previous message: Grumble: "Re: [C] whats the difference between "char" and "Char" ?"
- Next in thread: Leor Zolman: "Re: destructor problems"
- Reply: Leor Zolman: "Re: destructor problems"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|