Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- Car car1 = new Car();
- Car car2 = new Car();
- Car car3 = new Car();
- Car car4 = new Car();
- Car.brand = "BMW";
- Console.WriteLine(Car.brand);
- Car.SetBrand();
- Console.WriteLine(Car.brand);
- }
- }
- class Car
- {
- public static string brand;
- string model;
- double price;
- public Car(string model, double price)
- {
- this.model = model;
- this.price = price;
- }
- public Car()
- {
- this.model = "astra";
- this.price = 17000;
- }
- public static void SetBrand()
- {
- brand = "Lada";
- }
- }
Add Comment
Please, Sign In to add comment