[Exercise 8] [Content] [Exercise 10]

Exercise 9


Task 9.1

Add constructors to object oriented implementation of points from previous exercise. Declare two constructors:

Solution:

Library:point2.h, point2.cpp
Application:app_point2.cbp, app_point2.cpp


Task 9.2

Think about object oriented implementation of the program which draws rectangle using '*' and implement it. The comments are in the presentation: rectangle_drawing.pptx.
The program using structured programming is downloadable:

CodeBlocks:drawing_rectangle.cbp, drawing_rectangle.cpp

Prepared code:

Library:Rectangle.h, Rectangle.cpp
Application:rectangle_OOP.cbp, rectangle_OOP.cpp

Solution:

Library:Rectangle.h, Rectangle.cpp
Application:rectangle_OOP.cbp, rectangle_OOP.cpp


Task 9.3

Study implementation of Vector. Add an implementation of the copy constructor and extend all constructors by prompts like Implicit constructor is called to see when each constructor is called.

Library:TVectorp.h, TVectorp.cpp
Application:vectorp.cbp, vectorp.cpp

Solution:

Library:TVector.h, TVector.cpp
Application:vector.cbp, vector.cpp


[Exercise 8] [Content] [Exercise 10]