Advertisement
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 WorldITMOMIM
- {
- class Person : IIntroducable // : Object
- {
- protected string name;
- protected int age;
- public string Name
- {
- get { return name; }
- set { name = value; }
- }
- public int Age
- {
- get { return age; }
- set { age = value; }
- //if (value > 120 || value < 0)
- //{
- // value = 0;
- //}
- //age = value; }
- }
- public Person()
- : this("Default", 0)
- {
- //this.name = "Default";
- //this.age = 0;
- }
- // working horse
- public Person(string name, int age)
- {
- this.name = name;
- this.age = age;
- }
- //public string GetName()
- //{
- // return name;
- //}
- //public void SetName(string name)
- //{
- // this.name = name;
- //}
- //public void SetAge(int age)
- //{
- // if (age > 120 ||age < 0)
- // {
- // age = 0;
- // }
- // this.age = age;
- //}
- public virtual void IntroduceYourSelf()
- {
- Console.WriteLine("My name is {0}. I am {1} years old.", name, age);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement