SHOW:
|
|
- or go back to the newest paste.
| 1 | - | using System; |
| 1 | + | public Sklad() |
| 2 | - | using System.Collections.Generic; |
| 2 | + | |
| 3 | - | using System.Linq; |
| 3 | + | tovars[0] = new Tovar(); |
| 4 | - | using System.Text; |
| 4 | + | tovars[1] = new Tovar(); |
| 5 | - | |
| 5 | + | |
| 6 | - | namespace ConsoleApplication3 |
| 6 | + | |
| 7 | - | {
|
| 7 | + | |
| 8 | - | class Tovar |
| 8 | + | |
| 9 | } | |
| 10 | - | public Tovar() |
| 10 | + | |
| 11 | {
| |
| 12 | - | nameT = "Яблоки"; |
| 12 | + | get |
| 13 | - | nameM = "Фуршет"; |
| 13 | + | {
|
| 14 | - | cost = 10; |
| 14 | + | |
| 15 | {
| |
| 16 | - | private string nameT; |
| 16 | + | |
| 17 | - | private string nameM; |
| 17 | + | |
| 18 | - | private int cost; |
| 18 | + | |
| 19 | - | public string name_T{get{return nameT;}}
|
| 19 | + | |
| 20 | - | public string name_M{get{return nameT;}}
|
| 20 | + | |
| 21 | - | public int Cost{get{return cost;}}
|
| 21 | + | return tovars[i]; |
| 22 | } | |
| 23 | - | |
| 23 | + | |
| 24 | - | class Sklad |
| 24 | + | |
| 25 | class Program | |
| 26 | - | private Tovar [] tovars = new Tovar[2]; |
| 26 | + | |
| 27 | static void Main(string[] args) | |
| 28 | {
| |
| 29 | Sklad sklad = new Sklad(); | |
| 30 | Console.WriteLine("Название магазина " + sklad[0].name_M + ", название товара " + sklad[0].name_T + ", цена " + sklad[0].Cost);
| |
| 31 | Console.WriteLine(sklad["яблоки"]); | |
| 32 | // Console.WriteLine("Название магазина " + sklad[0].name_M);
| |
| 33 | - | get {
|
| 33 | + | |
| 34 | } | |
| 35 | } |