3.1 & 3.2
- Each class you create becomes a new type you can use to declare variables and create objects
- C++ is an extensible programming language -- you can define new class types as needed.
- Classes cannot execute by themselves.
- A main function can "drive" an object by calling its member functions -- without knowing how the class is implemented. In this sense, main is referred to as a driver program
- Typically, you cannot call a member function of a class until you create an object of that class
- The compiler knows about fundamental types that are "built into" C++
- A new type that you create is known as a user-defined type
- New classes, when packaged properly, can be reused by other programmers
- Reusable code ( such as a class definition) is placed in a file known as a header that you include (via #include) wherever you need to use the code
- By convention, a header for a user-defined type has a .h filename extension
- In an #include directive, a user-defined header is placed in double quotes (" "), indicating that the heade ris located with your program, rather than with the C++ Standard Library headers.
- Files ending in .cpp are known as source-code files
- To call a member function for a specific object, you specify the object's name, followed by a dot operator, then the member function name and a set of parentheses. Empty parentheses indicate that the function does not require any additional information to perform its task
- A member function can return a value form the object on which the function is called
- Functions that are not members of a class are called global functions
- An object of C++ Standard Library class string stores character string values. Class string is defined in the <string> header and belongs to namespace std.
- C++ Standard library function getline from the <string> header, reads character up to, but not including a newline, which is discarded, then places the characters in a string.
- A member-function call can supply arguments that help the function perform its task.