Advertisement
Tellexxii

Untitled

Jul 24th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 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 ForTest
  8. {
  9.    
  10.  
  11.     class Program
  12.     {
  13.        
  14.  
  15.         static void Main(string[] args)
  16.         {
  17.             //Person man = new Person("Steve", 17, PersonBehavior.Agressive);
  18.             //Console.WriteLine(man.ShowBehavior());
  19.         }
  20.     }
  21.  
  22.     public enum PersonBehavior { Agressive, Passive, Polite };
  23.  
  24.     class Person
  25.     {
  26.         public string Name;
  27.         public int Age;
  28.         private PersonBehavior Behavior;
  29.  
  30.         public Person(string name, int age)
  31.         {
  32.             Name = name;
  33.             Age = age;
  34.         }
  35.  
  36.         public Person(string name, int age, PersonBehavior behavior)
  37.         {
  38.             Name = name;
  39.             Age = age;
  40.             Behavior = behavior;
  41.         }
  42.         public PersonBehavior ShowBehavior()
  43.         {
  44.             return Behavior;
  45.         }
  46.     }
  47.     class Employee : Person
  48.     {
  49.         protected int Salary;
  50.  
  51.         public Employee(int salary, string name, int age) : base(name, age)
  52.         {
  53.             Salary = salary;
  54.         }
  55.     }
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement