Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Person1b
- {
- class Person : Introducable
- {
- protected string name;
- protected int age;
- public static int counter = 0;
- public static string nationality = "Bulgarian";
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- public int Age
- {
- get { return age; }
- set { age = value; }
- }
- // working horse!!!
- public Person(string name, int age)
- {
- this.name = name;
- this.age = age;
- counter++;
- }
- public Person()
- :this("Default", 0)
- {
- // this.name = "Deafult";
- // this.age = 0;
- }
- public Person(int age, string name)
- : this(name, age)
- {
- // this.name = name;
- // this.age = age;
- }
- public virtual void IntroduceYourSelf()
- {
- Console.WriteLine("My name is {0}!. I am {1} years old! I am {2}",
- name, age, nationality);
- }
- /*
- public string GetName()
- {
- return name;
- }
- public void SetName(string name)
- {
- this.name = name;
- }
- public int GetAge()
- {
- return age;
- }
- public void SetAge(int age)
- {
- this.age = age;
- }
- */
- }
- }
Add Comment
Please, Sign In to add comment