Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* A method can be declared as virtual, that way it can be changed with override in inheriting classes */
- class Pet
- {
- public virtual void Eat()
- {
- Console.WriteLine("Your pet thinks about what it may have for dinner today.");
- }
- }
- class Cat : Pet
- {
- public override void Eat()
- {
- Console.WriteLine("Your cat eats something.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement