Wednesday, 14 August 2013

What is the difference between these two instances?

What is the difference between these two instances?

I have this constructor:
BaseState::BaseState(const BaseState& s) {
id = s.id;
acceptance = s.acceptance;
}
and this overloaded operator
BaseState& BaseState::operator=(const BaseState& s) {
acceptance = s.acceptance;
id = s.id;
return *this;
}
So my question is the following: creating an instance like
//primary is a BaseState defined previously
BaseState* temp = new BaseState(primary);
or
BaseState* temp = primary;
should be the same thing, or is there any difference?

No comments:

Post a Comment