Advertisement
BloodMoonYTC

poliformizmusprintdata

Nov 18th, 2021
772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 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 polimorfizmusprintdata
  8. {
  9.     class PrintData
  10.     {
  11.         public void print(int h)
  12.         {
  13.             Console.WriteLine("int: {0} ", h);
  14.         }
  15.         public void print(double f)
  16.         {
  17.             Console.WriteLine("double: {0} ", f);
  18.         }
  19.         public void print(string s)
  20.         {
  21.             Console.WriteLine("string: {0} ", s);
  22.         }
  23.     }
  24.     class Program
  25.     {
  26.         static void Main(string[] args)
  27.         {
  28.             PrintData p = new PrintData();
  29.             p.print(12);
  30.             p.print(500.212);
  31.             p.print("Hello World");
  32.             Console.ReadKey();
  33.         }
  34.     }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement