[Exercise 8] | [Content] | [Exercise 10] |
Add constructors to object oriented implementation of points from previous exercise. Declare two constructors:
- implicit one which sets coordinates to zero
- constructor with parameters which sets coordinates according to parameters
Solution:
Library: point2.h, point2.cpp Application: app_point2.cbp, app_point2.cpp
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
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] |