Re: Subclass hiding method problem.
- From: "jmarc" <jmarc@xxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 15 Mar 2007 00:01:54 GMT
Define the superclass Delete() as virtual...
Then, redefine this method (no agr)
within the private section of your subclass..
along to the untouched other method (with arg)
No need to define em as virtual this time!
If the superclass still can be instantiated
as before if it is not a pure class.
You wont need to specify the class::
to call the right method, from your
client... The instance will know with one
to use...
jmarc...
See..!......
class DllExport LSDBTable
{
public:
virtual bool Delete();
};
class DllExport LSDBOtherTable : public LSDBTable
{
public:
bool Delete(long RecNo);
private:
bool Delete();
};
"AliR (VC++ MVP)" <AliR@xxxxxxxxxxxxx> wrote in message
news:sMZJh.5630$Um6.4457@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi guys,
I can't wrap my head around this problem. I have two classes in a DLL
that inherit from each other. They both have a method called Delete but
with different parameters. If I have an instance of the subclass and try
to call the delete that's defined in the superclass the compiler says
"function does not take 0 arguments"
here are the definitions
class DllExport LSDBTable
{
public:
bool Delete();
};
class DllExport LSDBOtherTable : public LSDBTable
{
public:
bool Delete(long RecNo);
};
void main()
{
LSDBOtherTable Table;
...
Table.Delete();
Table.LSDBTable::Delete(); //compiles fine
}
DllExport is defined as
__declspec(dllexport) when compiling the dll
and
__declspec(dllimport) when compiling the app that includes the dll
Any ideas why Table.Delete() would cause an error?
AliR.
.
- References:
- Subclass hiding method problem.
- From: AliR \(VC++ MVP\)
- Subclass hiding method problem.
- Prev by Date: Re: Creating Bitmaps for CBitmapButtons at runtime
- Next by Date: Heap corruption error.
- Previous by thread: Re: Subclass hiding method problem.
- Next by thread: Re: Subclass hiding method problem.
- Index(es):