Advertisement
wingman007

C#_OOP_Principles_Giraffe.cs

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