Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #### program.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Program
- {
- static void Main(string[] args)
- {
- while (true)
- {
- var abc = new Auto();
- abc.PrzedstawSie();
- break;
- }
- Console.ReadLine();
- }
- }
- }
- ### auto.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- class Auto
- {
- string carname, marka;
- public Auto()
- {
- string name = "domyslne";
- Console.WriteLine("Stworzyłeś auto {0}", name);
- carname = name;
- marka = "audi";
- }
- public Auto(string name) {
- Console.WriteLine("Stworzyłeś auto {0}", name);
- carname = name;
- marka = "audi";
- }
- ~Auto()
- {
- Console.WriteLine("zamykam auto");
- }
- public void PrzedstawSie()
- {
- Console.WriteLine(carname);
- mareczka();
- }
- private void mareczka()
- {
- Console.WriteLine("a marka to {0}", marka);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement