Advertisement
Stanislav2812

Untitled

Aug 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 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 YaYuniorLesson8_OOP
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             House house = new House(ConsoleColor.Blue, "Lenina,6", 15);
  14.             string ad = house.Adress;
  15.             Console.WriteLine(ad);
  16.             ConsoleColor tempFc = Console.ForegroundColor;
  17.             Console.WriteLine(house.HouseAdress());
  18.             Console.ForegroundColor = tempFc;
  19.         }
  20.     }
  21.  
  22.     class Tenant
  23.     {
  24.         public string Name;
  25.         public int Age;
  26.         public Tenant(string name, int age)
  27.         {
  28.             Name = name;
  29.             Age = age;
  30.         }
  31.     }
  32.  
  33.     class House
  34.     {
  35.         public ConsoleColor Color;
  36.         public string Adress;
  37.         public int MaxNum;
  38.         private Tenant[] Group;
  39.         public House(ConsoleColor color, string adress, int maxnum)
  40.         {
  41.             Color = color;
  42.             Adress = adress;
  43.             MaxNum = maxnum;
  44.             Group = new Tenant[maxnum];
  45.         }
  46.  
  47.         public string HouseAdress()
  48.         {
  49.             ConsoleColor tempFc = Console.ForegroundColor;
  50.             Console.ForegroundColor = Color;
  51.             return Adress;
  52.         }
  53.        
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement