Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Inheritance
- {
- class Human
- {
- static void Main(string[] args)
- {
- Women Nadia = new Women();
- Nadia.Do();
- Men Denis = new Men();
- Denis.Do();
- }
- public virtual void Do()
- {
- Console.WriteLine("Do it ");
- }
- }
- class Women : Human
- {
- public override void Do()
- {
- base.Do();
- Console.WriteLine("women");
- }
- }
- class Men : Human
- {
- public override void Do()
- {
- base.Do();
- Console.WriteLine("men");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement