Is it possible to "specialize" a base object to become a derived object?
For example:
class base{...
base(...) : ... {}//both have their own constructors
virtual void foo(){}
}
class derived : public base{...
void foo() override; //actual function in cpp
...}
int main(){
base x;
//is it possible to do something to x so
x.foo(); // will call derived::foo()
}
Aucun commentaire:
Enregistrer un commentaire