Advertisement
wingman007

C#_OOP_Principles_Elephant.cs

May 19th, 2014
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 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 Exam
  8. {
  9.     class Elephant : Animal
  10.     {
  11.         private int weight;
  12.  
  13.         public int Weight
  14.         {
  15.             get {return weight;}
  16.             set { weight = value; }
  17.         }
  18.  
  19.         public Elephant()
  20.             : this(0, "ElephantNoname", 0)
  21.         { }
  22.  
  23.         public Elephant(int age, string name, int weight)
  24.             : base("Elephant", age, name)
  25.         {
  26.             this.weight = weight;
  27.         }
  28.  
  29.         public override string IntroduceYourSelf()
  30.         {
  31.             return base.IntroduceYourSelf() + " Weight:" + weight;
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement