C++ OOP — INHERITANCE LAB
C++ OOP — INHERITANCE LAB
10 Programming Problems
Reference: Lafore, Object-Oriented Programming in C++ (4th ed),
Chapter 9 — Inheritance
==============================================================
PROBLEM 1 — Number, Complex, Quaternion
Build a 3-level hierarchy for number systems with operator overloading
and magnitude functions. Show non-commutativity of quaternion multiplication.
-------------------------------------------------------------PROBLEM 2 — Polygon Hierarchy
Implement Polygon → RegularPolygon → Triangle, Square, Hexagon.
Compare general vs specialized area formulas.
-------------------------------------------------------------PROBLEM 3 — Matrix Hierarchy
Matrix → SquareMatrix → DiagonalMatrix
Add determinant, trace, inverse.
-------------------------------------------------------------PROBLEM 4 — Fraction & MixedFraction
Implement rational arithmetic with reduction and mixed display.
-------------------------------------------------------------PROBLEM 5 — Vector Hierarchy
Vector2D → Vector3D → Vector4D
Include dot, cross, magnitude, normalization.
-------------------------------------------------------------PROBLEM 6 — Series Hierarchy
Arithmetic, Geometric, Fibonacci series with timing comparison.
-------------------------------------------------------------PROBLEM 7 — DateTime (Multiple Inheritance)
Combine Date + Time and implement addSeconds with leap year handling.
-------------------------------------------------------------PROBLEM 8 — Distance 3D
Extend feet-inch system into 2D and 3D distance calculations.
-------------------------------------------------------------PROBLEM 9 — Toy RSA
Prime → Factorizer → RSA system with encryption/decryption.
-------------------------------------------------------------PROBLEM 10 — Money & Accounts
Money + Account hierarchy with savings and checking behaviors.
==============================================================