August 2001
Beginner
482 pages
10h 52m
English
After you define an actual Cat object (for example, Frisky), you use the dot operator (.) to access the member functions of that object. Therefore, to assign 50 to Frisky's itsWeight member variable, you would write
Frisky.itsWeight = 50;
In the same way, to call the Meow() function, you would write
Frisky.Meow();
In C++ you don't assign values to types; you assign values to variables. For example, you would never write
int = 5; // wrong
The compiler would flag this as an error because you can't assign 5 to an integer. Rather, you must define an integer variable and assign 5 to that variable. For example:
int x; // define x to be an int x = 5; // set x's value to 5
This is a shorthand ...
Read now
Unlock full access