J
jimjim
Hello all,
class Base {
public:
virtual void f(){ } };
void userCode(Base base) { }
class Derived : public Base{
int i; };
int main() {
Derived derived;
Base base = derived;
userCode(derived);
return 0; }
How is the Base base = derived possible. Is there a copy constructor
Base::Base( const Derived &) povided by default? The same question applies
to the userCode(derived) invokation, where an object of Derived type is
copied to a Base.
TIA
class Base {
public:
virtual void f(){ } };
void userCode(Base base) { }
class Derived : public Base{
int i; };
int main() {
Derived derived;
Base base = derived;
userCode(derived);
return 0; }
How is the Base base = derived possible. Is there a copy constructor
Base::Base( const Derived &) povided by default? The same question applies
to the userCode(derived) invokation, where an object of Derived type is
copied to a Base.
TIA