0

Please explain this line ....Vehicle v1 = new Vehicle();

30th Aug 2018, 8:19 AM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar
2 Answers
+ 1
Your object v1 is created using the Constructor of Vehicle. Supposing it is C# : Your class Vehicle.cs has a constructor (public and name of the class) : public class Vehicle{ public Vehicle(){ } public void vroom(){ Console.WriteLine("Vrooom"); } } Once your object v1 is created, you can call the different methods in your class Vehicle, per example vroom() by writing v1.vroom(); Classes are used to make your code easier to read. While playing with C#, you will discover the utility. Just enjoy coding. :)
30th Aug 2018, 8:28 AM
Sam Pache
Sam Pache - avatar
0
tq
30th Aug 2018, 8:30 AM
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA
AKELLA TARUN SAI LAKSHMI NARAYANA SARMA - avatar