B
Birt
1. When defining only a copy constructor but no other constructors, the
default constructor will not be available any more in a class?
2.
class CEngine
{
....
public
// CEngine();//Without this, error happens
CEngine(int volume);
....
};
class CFord : public CCar
{
CEngine e;
public:
CFord(const CFord& f);
CFord& operator=(const CFord& f);
....
};
When adding CFord(const CFord& f); into CFord, the error happens:
error C2512: 'CEngine' : no appropriate default constructor available.
To solve the problem, add a default constructor by myself. Is there any
better solution?
How to force to use the CEngine(int volume) constructor?
default constructor will not be available any more in a class?
2.
class CEngine
{
....
public
// CEngine();//Without this, error happens
CEngine(int volume);
....
};
class CFord : public CCar
{
CEngine e;
public:
CFord(const CFord& f);
CFord& operator=(const CFord& f);
....
};
When adding CFord(const CFord& f); into CFord, the error happens:
error C2512: 'CEngine' : no appropriate default constructor available.
To solve the problem, add a default constructor by myself. Is there any
better solution?
How to force to use the CEngine(int volume) constructor?