C# – Enumeration – Classes builders

This week I have started again to look into Object Oriented Programming with C#. Thus, I have built a small example of OOP, using Enumeration.

In the example I have two classes – the class “RunningCar”, containing the Main method and the class “SpeedCar”, defining the property speed, with a constructor and a getter.

Finally the result of the code is the following 🙂 :

ClassesCSharp

Let’s see what we have in the code:

  • The enumeration part

  • Public Class with the property, the builder and the getter:

  • Finally the second class, containing the Main method, in which we define two objects – a Ferrari with enum “InTown” and Audi with enum OutOfTown. I hope you get the idea:

The whole code is located here:

Enjoy it! 🙂

About

VBA Developer

Tagged with: , ,