Advertisement
k_vychodilova

kompozice

Feb 28th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.67 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------Adam------------------------------------------------------------------------------
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace Kompozice
  9. {
  10.     class Dvere
  11.     {
  12.         public string material { get; set; }
  13.         public string barva { get; set; }
  14.         public Okno okno { get; set; }
  15.        
  16.         public Dvere(string material, string barva, Okno okno)
  17.         {
  18.             this.material = material;
  19.             this.barva = barva;
  20.             this.okno = okno;
  21.         }
  22.     }
  23.  
  24.     class Okno
  25.     {
  26.         public bool tonovani { get; set; }
  27.        
  28.         public Okno(bool tonovani)
  29.         {
  30.             this.tonovani = tonovani;
  31.         }
  32.     }
  33.  
  34.     class Program
  35.     {
  36.         static void Main(string[] args)
  37.         {
  38.             Okno okno = new Okno(true);
  39.             Dvere dvere = new Dvere("Plast", "Zelená", okno);
  40.         }
  41.     }
  42. }
  43.  
  44. -------------------------------------------------------------------------------------------------Marian------------------------------------------------------------------------------
  45. using System;
  46. using System.Collections.Generic;
  47. using System.Linq;
  48. using System.Text;
  49. using System.Threading.Tasks;
  50.  
  51. namespace Kompozice_soucastky
  52. {
  53.  
  54.     class Karoserie
  55.     {
  56.         public string barva { get; set; }
  57.  
  58.         public Dvere dvere { get; set; }
  59.  
  60.         public Karoserie(string barva, Dvere dvere)
  61.         {
  62.             this.barva = barva;
  63.             this.dvere = dvere;
  64.         }
  65.     }
  66.  
  67.     class Dvere
  68.     {
  69.         public Okno okno { get; set; }
  70.         public Dvere(Okno okno)
  71.         {
  72.             this.okno = okno;
  73.         }
  74.     }
  75.  
  76.     class Okno
  77.     {
  78.         public string material { get; set; }
  79.         public string velikost { get; set; }
  80.  
  81.         public Okno(string material, string velikost)
  82.         {
  83.             this.material = material;
  84.             this.velikost = velikost;
  85.         }
  86.     }
  87.     class Program
  88.     {
  89.         static void Main(string[] args)
  90.         {
  91.             Okno oknenko = new Okno("upecenypisek", "12");
  92.             Dvere vrata = new Dvere(okenko);
  93.             Karoserie karca = new Karoserie("modrá", vrata);
  94.         }
  95.     }
  96. }
  97.  
  98. ///////////////////////////////////////////////////////////////////////////////
  99. using System;
  100. using System.Collections.Generic;
  101. using System.Linq;
  102. using System.Text;
  103. using System.Threading.Tasks;
  104.  
  105. namespace ConsoleApplication10
  106. {
  107.     class Motor
  108.     {
  109.         public int Objem { get; set; }
  110.         public string Typ { get; set; }
  111.  
  112.         public Motor(int objem, string typ)
  113.         {
  114.             Objem = objem;
  115.             Typ = typ;
  116.         }
  117.     }
  118.     class Prevodovka
  119.     {
  120.         public string Vyrobce { get; set; }
  121.         public string Typ { get; set; }
  122.  
  123.         public Prevodovka(string vyrobce, string typ)
  124.         {
  125.             Vyrobce = vyrobce;
  126.             Typ = typ;
  127.         }
  128.     }
  129.     class Auto
  130.     {
  131.         public Motor MotorAuta { get; set; }
  132.         public Prevodovka PrevodovkaAuta { get; set; }
  133.  
  134.         public Auto(Motor mot, Prevodovka prev)
  135.         {
  136.             MotorAuta = mot;
  137.             PrevodovkaAuta = prev;
  138.         }
  139.     }
  140.  
  141.     class Program
  142.     {
  143.         static void Main(string[] args)
  144.         {
  145.             Motor mot = new Motor(4999, "Benzin");
  146.             Prevodovka prev = new Prevodovka("Bosch","Automat");
  147.             Auto auto = new Auto(mot, prev);
  148.             Console.WriteLine(auto.MotorAuta.Objem);
  149.  
  150.             Console.ReadKey();
  151.  
  152.  
  153.         }
  154.     }
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement