Calling methods on Objects
- by Mashael
Let's say we have a class called 'Automobile' and we have an instance of that class called 'myCar'. I would like to ask why do we need to put the values that our methods return in a variable for the object? Why just don't we call the method?
For example:
Why should we write:
string message = myCar.SpeedMessage();
Console.WriteLine(message);
instead of:
Console.WriteLine(myCar.SpeedMessage());