Advertisement
Stanislav2812

Untitled

Aug 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 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 YaYuniorLesson9
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             //  Добавьте в класс Person метод, который будет возвращать поведение объекта Person (возвращаемый тип - созданный нами Enum)
  14.         }
  15.     }
  16.  
  17.     enum PersonBehavior
  18.     {
  19.         Aggressive,
  20.         Passive,
  21.         Polite,
  22.     }
  23.     class Person
  24.     {
  25.         public string Name;
  26.         public int Age;
  27.         private PersonBehavior Behavior;
  28.  
  29.         public Person (string name, int age, PersonBehavior behavior)
  30.             {
  31.             Name = name;
  32.             Age = age;
  33.             Behavior = behavior;
  34.             }
  35.         public Person(string name, int age, PersonBehavior behavior)
  36.         {
  37.             Name = name;
  38.             Age = age;            
  39.         }
  40.         public PersonBehavior GetBehavior()
  41.         {
  42.             return Behavior;
  43.         }
  44.  
  45.     }
  46.     class Employee : Person
  47.     {
  48.         protected int Salary;
  49.         public Employee(string name, int age)
  50.             {
  51.             Name = name;
  52.             Age = age;
  53.             }
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement