Advertisement
BloodMoonYTC

kutya

Nov 18th, 2021
728
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace kutya
  8. {
  9.     class kutya
  10.     {
  11.         public virtual void KiVagyTe()
  12.         {
  13.             Console.WriteLine("En egy kutya vagyok");
  14.         }
  15.     }
  16.  
  17.     class vizsla : kutya
  18.     {
  19.         public override void KiVagyTe()
  20.         {
  21.             Console.WriteLine("En egy vizsla vagyok");
  22.         }
  23.     }
  24.  
  25.     class magyarvizsla : vizsla
  26.     {
  27.         public override void KiVagyTe()
  28.         {
  29.             Console.WriteLine("En egy magyar vizsla vagyok");
  30.         }
  31.         public void Vadasz()
  32.         {
  33.             Console.WriteLine("En vadasz vagyok");
  34.         }
  35.     }
  36.  
  37.     class Program
  38.     {
  39.         static void Main(string[] args)
  40.         {
  41.             kutya a = new vizsla();
  42.             Console.WriteLine("Az 'a' objektum tipusa: " + a.GetType());
  43.             a.KiVagyTe();
  44.             kutya b = new magyarvizsla();
  45.             Console.WriteLine("A 'b' objektum tipusa: " + b.GetType());
  46.             b.KiVagyTe();
  47.             Console.ReadKey();
  48.         }
  49.     }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement