Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Transport
- {
- protected string brand;
- protected string model;
- protected int year;
- protected string color;
- public Transport(string brand, string model, int year, string color)
- {
- this.brand = brand;
- this.model = model;
- this.year = year;
- this.color = color;
- }
- public string Brand
- {
- get { return brand; }
- set { brand = value; }
- }
- public string Model
- {
- get { return model; }
- set { model = value; }
- }
- public int Year
- {
- get { return year; }
- set { year = value; }
- }
- public string Color
- {
- get { return color; }
- set { color = value; }
- }
- }
- public class Car : Transport
- {
- public Car(string brand, string model, int year, string color)
- : base(brand, model, year, color)
- {
- }
- public void Drive()
- {
- Console.WriteLine("Driving the car");
- }
- }
- public class Bike : Transport
- {
- public Bike(string brand, string model, int year, string color)
- : base(brand, model, year, color)
- {
- }
- public void Ride()
- {
- Console.WriteLine("Riding the bike");
- }
- }
Comments
-
- просто бомба
-
- Илья если ты это читаешь то прости, чуток у тебя подсмотрел >:)
Add Comment
Please, Sign In to add comment