Created
October 7, 2025 05:02
-
-
Save sunmeat/a256893d882e326e02226cd87b7e7e91 to your computer and use it in GitHub Desktop.
early binding C#
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Transport | |
{ | |
public void Drive() | |
{ | |
Console.WriteLine("Transport::Drive()"); | |
} | |
} | |
class Car : Transport | |
{ | |
public new void Drive() | |
{ | |
Console.WriteLine("Car::Drive()"); | |
} | |
} | |
class Bike : Transport | |
{ | |
public new void Drive() | |
{ | |
Console.WriteLine("Bike::Drive()"); | |
} | |
} | |
class Tram : Transport | |
{ | |
public new void Drive() | |
{ | |
Console.WriteLine("Tram::Drive()"); | |
} | |
} | |
class Program | |
{ | |
static void Main() | |
{ | |
Car c = new Car(); | |
Bike b = new Bike(); | |
c.Drive(); | |
b.Drive(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment