T
Tony Johansson
Hello!
I have this inheritance below. My base class is Car and derived from that is
SportCar.
When I create an instance of SportCar I assume that I can consider to have
an instance of my Car object within the instance of SportCar. Does that
sound reasonable ?
If we can agree upon that I come to next question.
If I now make the Car class abstract which mean that it's not possible to
have an instance of a Car class.
When I now create an instance of a SportCar where the base class Car is
abstract does the runtime
create an instance of Car behind the scene because I can still use
base.Drive() in method Foo in class SportCar.
class Car
{
public void Drive()
{
}
}
class SportCar : Car
{
public void Foo()
{
base.Drive();
}
}
//Tony
I have this inheritance below. My base class is Car and derived from that is
SportCar.
When I create an instance of SportCar I assume that I can consider to have
an instance of my Car object within the instance of SportCar. Does that
sound reasonable ?
If we can agree upon that I come to next question.
If I now make the Car class abstract which mean that it's not possible to
have an instance of a Car class.
When I now create an instance of a SportCar where the base class Car is
abstract does the runtime
create an instance of Car behind the scene because I can still use
base.Drive() in method Foo in class SportCar.
class Car
{
public void Drive()
{
}
}
class SportCar : Car
{
public void Foo()
{
base.Drive();
}
}
//Tony