Posts

Chapter 4

Image
4.2.1             //Create an account object and assign it to MyAccount             Account myAccount = new Account(); before you call a method of that class you need to actually create that class. Use an object-creating expression new Account() The  The new keyword creates a new object of the specified class which is Account. 4.2.2 Calling Class Account's GetName Method The method GetName in the Account class job is to  Return the account name that stored in a particular Account object //Display myAccount's initial name(there isn't one yet)             Console.WriteLine($"Initial name is: {myAccount.GetName()}"); in order to display the myAccount name by calling the object "GetName" method you need The object name (MyAccount)  The member access operator (.) The method name Set of parentheses(). The empty set of parentheses indicate that "...