Advertisement
valiamaximova1

C# practice class

Jul 8th, 2021
1,509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace ConsoleApp1
  6. {
  7.     class Main
  8.     {
  9.         Person p = new Person("Pesho", 20);
  10.         Person p1 = new Person("Gosho", 18);
  11.         Person p2= new Person("Stamat", 43);
  12.  
  13.        
  14.  
  15.     }
  16. }
  17. using System;
  18.  
  19.  
  20.     class Person
  21.     {
  22.         private String name;
  23.         private int age;
  24.  
  25.     public Person(String name, int age)
  26.     {
  27.         this.Name = name;
  28.         this.Age = age;
  29.     }
  30.  
  31.     public int Age { get => age; set => age = value; }
  32.     public string Name { get => name; set => name = value; }
  33. }
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  using System;
  40.     class Person
  41.     {
  42.         private String name;
  43.         private int age;
  44.  
  45.     public Person(String name, int age)
  46.     {
  47.         this.Name = name;
  48.         this.Age = age;
  49.     }
  50.  
  51.     public int Age { get => age; set => age = value; }
  52.     public string Name { get => name; set => name = value; }
  53. }
  54.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement