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;
- using System.Threading.Tasks;
- namespace kutya
- {
- class kutya
- {
- public virtual void KiVagyTe()
- {
- Console.WriteLine("En egy kutya vagyok");
- }
- }
- class vizsla : kutya
- {
- public override void KiVagyTe()
- {
- Console.WriteLine("En egy vizsla vagyok");
- }
- }
- class magyarvizsla : vizsla
- {
- public override void KiVagyTe()
- {
- Console.WriteLine("En egy magyar vizsla vagyok");
- }
- public void Vadasz()
- {
- Console.WriteLine("En vadasz vagyok");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- kutya a = new vizsla();
- Console.WriteLine("Az 'a' objektum tipusa: " + a.GetType());
- a.KiVagyTe();
- kutya b = new magyarvizsla();
- Console.WriteLine("A 'b' objektum tipusa: " + b.GetType());
- b.KiVagyTe();
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement