Advertisement
wingman007

C#_OOP_3b_Human.cs

Apr 14th, 2014
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 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 App3b
  8. {
  9.     class Human
  10.     {
  11.         private string name;
  12.         private int age;
  13.         private double temp;
  14.         public static int counter;
  15.         public static string nationality = "Bulgarian";
  16.         public const double PI = 3.14;
  17.         public readonly double onlyRead = 4.5;
  18.  
  19.         public string Name
  20.         {
  21.             get { return name; }
  22.             set { name = value; }
  23.         }
  24.  
  25.         public int Age
  26.         {
  27.             get { return age; }
  28.             set { age = value; }
  29.         }
  30.  
  31.         public double Balance
  32.         {
  33.             get { return 2 * 2; }
  34.         }
  35.  
  36.         public Human()
  37.             : this("Deafult", 0)
  38.         {}
  39.  
  40.         public Human(string name, int age)
  41.         {
  42.             this.name = name;
  43.             this.age = age;
  44.             counter++;
  45.             onlyRead = 2.71;
  46.         }
  47.  
  48.         public Human(int age, string name)
  49.             : this(name, age)
  50.         {
  51.         }
  52.  
  53.         public void IntroduceYourSelf()
  54.         {
  55.             Console.WriteLine("My name is {0}. My age is {1}. My balance is {2}. I am {3}", name, age, Balance, nationality);
  56.         }
  57.  
  58.         public void IntroduceYourSelf(string verbous)
  59.         {
  60.             this.IntroduceYourSelf();
  61.             Console.WriteLine("I am verbous");
  62.         }
  63.  
  64.         public void Speak()
  65.         {
  66.             //...
  67.         }
  68.  
  69.         public void Render()
  70.         {
  71.             // ...
  72.         }
  73.  
  74.  
  75. /*
  76.         public string GetName()
  77.         {
  78.             return name;
  79.         }
  80.  
  81.         public void SetName(string name)
  82.         {
  83.             this.name = name;
  84.         }
  85.  
  86.         public int GetAge()
  87.         {
  88.             return age;
  89.         }
  90.  
  91.         public void SetAge(int age)
  92.         {
  93.             this.age = age;
  94.         }
  95. */
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement