- Review your midterm
be held tomorrow, Tuesday, 1/17, at 7:00 pm
- class definition, declaration
- data members, characteristics
- member functions, methods, messages, behaviors
- access specifier
- (member) function defintion
- scope resolution operator
- declaring an object
- calling a member function
- calling a member function with a dot operator
- calling a member function with an arrow operator
- inline function
- implicit inline function
- explict inline function
- const member function
from the textbook (pages 724-726)
your name, the compiler used, and Lab Exercise #7 in a comment at the
top of your program. Email your source code. You
may email your lab solution prior to that.
Modify example, Program
13-1 from the textbook, by adding a
getPerimeter() function to the class. Use the
main() function below to test your code.
Rectangle box; // Define an instance of the Rectangle class
double rectWidth; // Local variable for width
double rectLength; // Local variable for length
// Get the rectangle's width and length from the user.
cout << "This program will calculate the area of a\n";
cout << "rectangle. What is the width? ";
cin >> rectWidth;
cout << "What is the length? ";
cin >> rectLength;
// Store the width and length of the rectangle
// in the box object.
// Display the rectangle's data.
cout << "Here is the rectangle's data:\n";
cout << "Width: " << box.getWidth() << endl;
cout << "Length: " << box.getLength() << endl;
cout << "Area: " << box.getArea() << endl;
cout << "Perimeter: " << box.getPerimeter() << endl;