Skip to content

Instantly share code, notes, and snippets.

@CodeWarrior-Hawaii
Last active January 24, 2017 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodeWarrior-Hawaii/db8d5bab337a52df980e18cd97c18c34 to your computer and use it in GitHub Desktop.
Save CodeWarrior-Hawaii/db8d5bab337a52df980e18cd97c18c34 to your computer and use it in GitHub Desktop.
namespace VehicleStuff
{
public class Class1
{
public void DoSomething()
{
var myCar = new Car("Pontiac", "Firebird");
var myBike = new Bike("Honda", "1984");
}
}
public abstract class Vehicle
{
public enum DoorsEnum
{
Doors1,
Doors2,
Doors4,
DoorsMany,
DoorsNone
}
public enum WheelsEnum
{
Wheels1,
Wheels2,
Wheels3,
Wheels4,
Wheels6,
Wheels8,
WheelsMany,
WheelsNone
}
public enum EngineTypeEnum
{
Gasoline,
Diesel,
Electric,
Other
}
public DoorsEnum Doors { get; set; }
public WheelsEnum Wheels { get; set; }
public EngineTypeEnum Engine { get; set; }
public Vehicle(DoorsEnum doors, WheelsEnum wheels)
{
Doors = doors;
Wheels = wheels;
}
}
public class Car : Vehicle
{
public Car() : base(DoorsEnum.Doors4, WheelsEnum.Wheels4)
{
}
public Car(string make, string model) : this()
{
Make = make;
Model = model;
}
public string Make { get; set; }
public string Model { get; set; }
}
public class Bike: Vehicle
{
public Bike() : base(DoorsEnum.DoorsNone, WheelsEnum.Wheels2)
{
}
public Bike(string make, string year) : this()
{
Make = make;
Year = year;
}
public string Make { get; set; }
public string Year { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment