I am experimenting in C# and I am trying to figure out how i can have certain classes as types.
Scenario:
I have a car:
public class Car
{
public string Name { get; set; }
public Car()
{
}
public Car(string name, string type)
{
Name = name;
Type = type;
}
}
i would like the car to have a Type property. I have two car types:
public class MonsterTruck
{
public int Lengt => 1;
}
public class SportTruck
{
public int Lengt => 3;
}
Within the Car
class how can I have a "type" of the above two car-type classes?