Advertisement
dsavov_02

introduceyourself

Apr 6th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 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 ConsoleApp19
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Person person = new Person();
  14.             Person person1 = new Person("Pesho", 20);
  15.             person.IntroduceYourself();
  16.             person1.IntroduceYourself();
  17.         }
  18.     }
  19. }
  20.     class Person
  21.     {
  22.         string name;
  23.         int age;
  24.  
  25.         public Person(string name, int age)
  26.              {
  27.                this.name = name;
  28.                this.age = age;
  29.              }
  30.         public Person()
  31.         {
  32.                this.name = "Icko";
  33.                this.age = 16;
  34.         }
  35.     public void IntroduceYourself()
  36.     {
  37.         Console.WriteLine("I am {0} and i am {1} years old.", this.name, this.age);
  38.     }
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement