D
Dario
Trying to compile the following code-fragment with g++ 2.96:
class Entity {
private:
void * data;
public:
explicit Entity(int);
explicit Entity(Entity &);
virtual ~Entity();
void makeSomething();
};
Entity f(int n) {
Entity result(n);
result.makeSomething();
return result;
}
I obtain the error:
no matching function for call to `Entity::Entity (Entity &)'
on the the row:
return result;
It's a my fault?
The only way to get away from the error is to change the copy
constructor into:
/* explicit */ Entity(Entity &);
But I want to use explicit...
Is there any other option to solve my problem?
- Dario
class Entity {
private:
void * data;
public:
explicit Entity(int);
explicit Entity(Entity &);
virtual ~Entity();
void makeSomething();
};
Entity f(int n) {
Entity result(n);
result.makeSomething();
return result;
}
I obtain the error:
no matching function for call to `Entity::Entity (Entity &)'
on the the row:
return result;
It's a my fault?
The only way to get away from the error is to change the copy
constructor into:
/* explicit */ Entity(Entity &);
But I want to use explicit...
Is there any other option to solve my problem?
- Dario