Advertisement
kisame1313

Untitled

Jul 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main ( string [] args )
  6.     {
  7.         Person b = new Person ( "Abdulla", 155, PersonBehavior.agressive );
  8.         Console.WriteLine ( b.ShowBehavior () );
  9.     }
  10.  
  11.     public enum PersonBehavior
  12.     {
  13.         agressive, passive, polite
  14.     }
  15.  
  16.     class Person
  17.     {
  18.         public string Name;
  19.         public int Age;
  20.         PersonBehavior Behavior;
  21.  
  22.         public Person ( string name, int age, PersonBehavior behavior )
  23.         {
  24.             Name = name;
  25.             Age = age;
  26.             Behavior = behavior;
  27.         }
  28.  
  29.         public Person ( string name, int age )
  30.         {
  31.  
  32.         }
  33.  
  34.         public PersonBehavior ShowBehavior ()
  35.         {
  36.             return Behavior;
  37.         }
  38.     }
  39.  
  40.     class Employee : Person
  41.     {
  42.         protected float Salary;
  43.  
  44.         public Employee ( string name, int age, float salary ) : base ( name, age )
  45.         {
  46.             Name = name;
  47.             Age = age;
  48.             Salary = salary;
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement