public class SuperCar: Car
{
public bool SuperWheels { get {return true; } }
}
public class Car
{
public bool HasSteeringWheel { get {return true;} }
}
How can I set the base class for the derived Supercar?
For example, I want to simply set SuperCars base class like this:
public void SetCar( Car car )
{
SuperCar scar = new SuperCar();
car.Base = car;
}
Basically, if I have Car objects, I do not want to manually iterate through every property of the car in order to setup the SuperCar oject, which I think is the only way you can do it but if you can do it the other way it would be sooo much better.
(object)this == (object)base
is always true. There are ways to perform cloning/copying by reflection (and other means) though. Perhaps describe what is really wanted :) – Noreen