TheBulgarianWolf

OOP Basic Constructor

Jul 3rd, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. class Human
  2. {
  3.     public int Height;
  4.     public int Weight;
  5.    
  6.     public Human(int height,int weight)
  7.     {
  8.         Height = height;
  9.         Weight = weight;
  10.     }
  11.    
  12.     public void HumanProps()
  13.     {
  14.         Console.WriteLine("This human is {} cms long and weights {1} kgs.",Height,Weight);
  15.     }
  16. }
  17.  
  18. class EntryPoint
  19. {
  20.     public void Main()
  21.     {
  22.         Human Ivan = new Human(182,85);
  23.         Ivan.HumanProps();
  24.     }
  25. }
Add Comment
Please, Sign In to add comment