Guest User

Untitled

a guest
Jun 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace ConsoleApplication1
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             Car car;
  12.  
  13.             car = new Car("Red");
  14.             Console.WriteLine(car.Describe());
  15.  
  16.             car = new Car("Green");
  17.             Console.WriteLine(car.Describe());
  18.  
  19.             Console.ReadLine();
  20.         }
  21.     }
  22.  
  23.     class Car
  24.     {
  25.         private string color;
  26.  
  27.         public Car(string color)
  28.         {
  29.             this.color = color;
  30.         }
  31.  
  32.         public string Describe()
  33.         {
  34.             return "This car is " + Color;
  35.         }
  36.  
  37.         public string Color
  38.         {
  39.             get { return color; }
  40.             set { color = value; }
  41.         }
  42.     }
  43. }
Add Comment
Please, Sign In to add comment