This lab discusses:
What is a class
Member function definitions
How to instantiate an object of a class
How to call member functions
member function declarations
Member Function Definitions
output Class_name::memberfunName(input parameters)
body of the function
Point.cpp (Point class)
Write a Rectangle class using the Point class and test it using a main
program (i.e., in a main() function).
A rectangle is specified by two corner points. The sides
of the rectangle are parallel to the coordinate axes.
Consider the following design description of the Rectangle class:
- its bottom-left corner point
- its top-right corner point
- Can do:
- Return its bottom-left corner point
- Return its top-right corner point
- Return its circumference
- Return its area
- Move by dx and dy
BU CAS CS - Introduction to Classes
This page created by Jisook Youn <firstname.lastname@example.org>.
Material partially taken from the textbook "Computing Concepts with C++
Essentials", by Horstmann.