Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- namespace CSharpTest
- {
- class Car
- {
- private string carColor;
- private string carModel;
- private string carId;
- public Car() : this("", "", "") => Console.WriteLine("1 ctor call");
- public Car(string color) : this(color, "", "") => Console.WriteLine("2 ctor call");
- public Car(string color, string model) : this(color, model, "") => Console.WriteLine("3 ctor call");
- public Car(string color, string model, string id)
- {
- carColor = color;
- carModel = model;
- carId = id;
- Console.WriteLine("4 ctor call");
- }
- }
- class Bibika
- {
- private string bibikaColor;
- private string bibikaModel;
- private string bibikaId;
- public Bibika(string color = "", string model = "", string id = "")
- {
- bibikaColor = color;
- bibikaModel = model;
- bibikaId = id;
- Console.WriteLine("ctor call");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- CultureInfo.CurrentCulture = new CultureInfo("en-US", false);
- Car car1 = new Car();
- Car car2 = new Car("green");
- Car car3 = new Car("blue", "lada vesta");
- Car car4 = new Car("red", "camara", "103456");
- Bibika bibika1 = new Bibika();
- Bibika bibika2 = new Bibika(color: "green");
- Bibika bibika3 = new Bibika(color: "blue", model: "lada vesta");
- Bibika bibika4 = new Bibika(color: "red", id: "103456");
- Bibika bibika5 = new Bibika(model: "ferrari", id: "111111");
- Bibika bibika6 = new Bibika("pink", "vas", "222222");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement