Skip to content

Latest commit

 

History

History
52 lines (44 loc) · 2.05 KB

Module01.md

File metadata and controls

52 lines (44 loc) · 2.05 KB

Module 01

New rules

From now on, all your classes must be designed in the Orthodox Canonical Form. The class would implement with these four required member functions:

  • Default constructor
  • Copy constructor
  • Copy assignment operator
  • Destructor

Exercise 00 : Orthodox Canonical Form

Every time C++ creates its few elements in the class when it compiles. From now on your all class must be designed in Orthodox Canonical Form. Let’s start with a simple exercise.

  • Implement Car class
    • Member variable
      • name
      • speed
    • Member function
      • Constructor
      • Copy constructor
      • Copy assignment operator override
      • Destructor
  • Make an example with main function

Exercise 01 : Sports car

Inheritance is a fundamental concept of Object-Oriented Programming (OOP) that allows creating new classes based on already existing classes, thereby enabling code reusability and reducing code duplication. Inheritance allows a derived class to inherit properties and behaviors from a base class.

  1. Implement Car Class
    • Member variable
      • make
      • model
      • year
    • Member function
      • void drive();
        • Just print something like Driving "make" "model" "year" edition.
💡 Every member function has to print a message about what is happenning inside it.
  1. Implement Sports Car
    • inherit from Car class
    • Member variable
      • top speed
    • Member function
      • void drive();
        • Just print speed in addition to Car class's drive func.

Exercise 02 : A software defined Car

Expand the above example of Car to demonstrate all the main concepts of OOPs, including abstraction, encapsulation, inheritance, polymorphism, and modularity. Surprise yourself on what you can do (and can not do)!

Evaluation Form

Fill in this Evaluation Form Module01. You need to collect 2 feedbacks from 2 peers from other than your own team.