Click here to Skip to main content
15,892,059 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralMusic Application Pin
mavgoose3-Mar-04 6:16
mavgoose3-Mar-04 6:16 
GeneralRe: Music Application Pin
James R. Twine3-Mar-04 7:49
James R. Twine3-Mar-04 7:49 
Generalfatal error RC1015: cannot open include file 'afxres.h' Pin
spingkoy3-Mar-04 6:07
spingkoy3-Mar-04 6:07 
GeneralRe: fatal error RC1015: cannot open include file 'afxres.h' Pin
David Crow3-Mar-04 7:24
David Crow3-Mar-04 7:24 
GeneralRe: fatal error RC1015: cannot open include file 'afxres.h' Pin
spingkoy3-Mar-04 7:48
spingkoy3-Mar-04 7:48 
GeneralRe: fatal error RC1015: cannot open include file 'afxres.h' Pin
David Crow3-Mar-04 7:52
David Crow3-Mar-04 7:52 
GeneralRe: fatal error RC1015: cannot open include file 'afxres.h' Pin
spingkoy4-Mar-04 4:35
spingkoy4-Mar-04 4:35 
GeneralSubclassing : overloaded methods Pin
Jerome Conus3-Mar-04 5:51
Jerome Conus3-Mar-04 5:51 
Hi !

I'm facing a very strange problem with the code snippet below.

I'm creating a base class (JSBase) which provides two virtual methods. These two methods have the same name.

In a derived class, I reimplement only one of these two methods.

In the main(), I instanciate the derived class and call one of the method of the base class (the one which has not be reimplemented in the derived class).

When I compile, I get this error :

.\TestDerive.cpp(64) : error C2664: 'import' : cannot convert parameter 1 from '
class ClassTest1' to 'class ClassTest2'
No constructor could take the source type, or constructor overload resol
ution was ambiguous

What's wrong ? Can't I reimplement only one of the method in the derived class ?
I would appreciate a lot your help !
Thanks !
Jerome

class ClassTest1 {};
class ClassTest2 {};

// Base class
class JSBase
{
public:
	JSBase() {};
	virtual ~JSBase() {};

	virtual void import(ClassTest1 Data) {};
	virtual void import(ClassTest2 Data) {};
};

// Derived class
class JSDerived : public JSBase
{
public:
	JSDerived() : JSBase() {};
	~JSDerived() {};

	void import(ClassTest2 Data) {};
};

// Main
void main(int argc, char* argv[])
{
	JSDerived MyDerived;
	ClassTest1 MyData;
	MyDerived.import(MyData);
}

GeneralRe: Subclassing : overloaded methods Pin
jmkhael3-Mar-04 6:02
jmkhael3-Mar-04 6:02 
GeneralRe: Subclassing : overloaded methods Pin
Jerome Conus3-Mar-04 9:17
Jerome Conus3-Mar-04 9:17 
GeneralRe: Subclassing : overloaded methods Pin
toxcct3-Mar-04 6:35
toxcct3-Mar-04 6:35 
GeneralRe: Subclassing : overloaded methods [EDITED] Pin
John M. Drescher3-Mar-04 9:13
John M. Drescher3-Mar-04 9:13 
GeneralRe: Subclassing : overloaded methods Pin
Jerome Conus3-Mar-04 9:18
Jerome Conus3-Mar-04 9:18 
GeneralRe: Subclassing : overloaded methods Pin
John M. Drescher3-Mar-04 9:26
John M. Drescher3-Mar-04 9:26 
GeneralRe: Subclassing : overloaded methods [EDITED] Pin
Jerome Conus3-Mar-04 9:41
Jerome Conus3-Mar-04 9:41 
GeneralRe: Subclassing : overloaded methods [EDITED] Pin
John M. Drescher3-Mar-04 9:55
John M. Drescher3-Mar-04 9:55 
GeneralRe: Subclassing : overloaded methods Pin
DaBears6-Mar-04 19:11
DaBears6-Mar-04 19:11 
GeneralMessages when a service stops, restarts Pin
JensB3-Mar-04 5:50
JensB3-Mar-04 5:50 
GeneralRe: Messages when a service stops, restarts Pin
Prakash Nadar3-Mar-04 5:59
Prakash Nadar3-Mar-04 5:59 
GeneralC++ Shell Context Menu Extension Pin
James R. Twine3-Mar-04 5:45
James R. Twine3-Mar-04 5:45 
GeneralRead and Write Parallel port in W2000 Pin
acaselli3-Mar-04 5:30
acaselli3-Mar-04 5:30 
GeneralRe: Read and Write Parallel port in W2000 Pin
Prakash Nadar3-Mar-04 5:39
Prakash Nadar3-Mar-04 5:39 
GeneralRe: Read and Write Parallel port in W2000 Pin
acaselli4-Mar-04 22:15
acaselli4-Mar-04 22:15 
QuestionHow to set the path Pin
Member 7389383-Mar-04 4:39
Member 7389383-Mar-04 4:39 
AnswerRe: How to set the path Pin
David Crow3-Mar-04 7:26
David Crow3-Mar-04 7:26 

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.