Advertisement
Gillito

Untitled

Jul 20th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 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 ConsoleApplication56
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Student student = new Student(17);
  14.             Console.WriteLine(student.GetAdultHood);
  15.         }
  16.     }
  17.  
  18.     class Student
  19.     {
  20.         private int _age;
  21.  
  22.         public Student(int age)
  23.         {
  24.             _age = age;
  25.         }
  26.         public int CheckAge
  27.         {
  28.             get { return _age; }
  29.         }
  30.  
  31.         public string GetAdultHood
  32.         {
  33.             get
  34.             {
  35.                 if (_age >= 18)
  36.                     return "Совершеннолетний";
  37.                 else
  38.                     return "Несовершеннолетний";
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement