Advertisement
wingman007

C#_OOP_Principles_Animal.cs

May 19th, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.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 Exam
  8. {
  9.     abstract class Animal : AnimalInterface
  10.     {
  11.         private string type;
  12.         private int age;
  13.         private string name;
  14.  
  15.         public string Type
  16.         {
  17.             get { return type; }
  18.             set { type = value; }
  19.         }
  20.  
  21.         public int Age
  22.         {
  23.             get { return age; }
  24.             set { age = value; }
  25.         }
  26.  
  27.         public string Name
  28.         {
  29.             get { return name; }
  30.             set { name = value; }
  31.         }
  32.  
  33.         public Animal(string type, int age, string name)
  34.         {
  35.             this.type = type;
  36.             this.age = age;
  37.             this.name = name;
  38.         }
  39.  
  40.         public virtual string IntroduceYourSelf()
  41.         {
  42.             return "Type: " + type + ". Age: " + age + ". Name" + name;
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement