atsamy
New member
- Joined
- Feb 3, 2023
- Messages
- 1
- Programming Experience
- 10+
Hello All, so i have a parent class that has a variable from a parent class like so
so from class MotorBike i need to call functions inside MotorbikeTire without having to cast Tire into MotorbikeTire everytime, is there a way to do this.
C#:
Class Vehicle
{
public TireBase Tire;
}
Class Tire
{
public Pump()
{
}
}
Class MotorbikeTire:Tire
{
public Pump()
{
//different implementation
}
public Fix()
{
}
}
Class Motorbike:Vehicle
{
Public Motorbike()
{
Tire = new MotorbikeTire();
}
}
Last edited by a moderator: