Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- Kot k1 = new Kot(10);
- Kot k2 = new Kot();
- Kot[] k3 = new Kot[3]; // puste referencje, nie tworza sie obiekty
- // Musimy stworzyc obiekty za pomoca fora
- for (int i = 0; i < 3; i++ )
- {
- k3[i] = new Kot();
- }
- Console.WriteLine(k3[1].Il_wasow);
- Console.ReadKey();
- }
- }
- class Kot
- {
- public int Il_wasow;
- public Kot(int ilwasow)
- {
- Il_wasow = ilwasow;
- }
- public Kot()
- {
- Il_wasow = 12;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment