Basic Inheritance

public class Animal
{
public void Greet()
{
Console.WriteLine("Hello, I'm some sort of animal!");
}
}

public class Dog : Animal
{

}

Animal animal = new Animal(); 
animal.Greet();
Dog dog = new Dog();
dog.Greet();

Last modified: March 20, 2019

Author

Comments

Write a Reply or Comment