C++ Implementation of Object Models



C++ Implementation of Object Models

Objective

The objective of this activity is to give idea of practical implementation of basic object oriented concepts like:

▪ Abstraction

▪ Encapsulation

▪ Association

▪ Composition

▪ Inheritance

C++ Implementation for given Object Models.

You are required to provide a practical implementation in C++ for all given scenarios.

Step to transfer Object Model in C++ Implementation

Following step should be followed to convert and object model into a real coding program using C++ language.

Step 1: C++ Implementation for Classes

▪ Use standard notation of C++ for declaring classes.

▪ Use appropriate C++ syntax for declaring and defining each class.

▪ Should class interface and implementation will be done in same .cpp file or there should be a separation of interface and implementation.

▪ Think about access specifiers, which specifier should be used and why.

Step 2: C++ Implementation of relationship between classes

▪ In this step you are required to code relationship between classes using C++ conventions.

▪ C++ provides proper mechanism for usage of inheritance, composition and aggregation. All these are already discussed in lectures in great details.

▪ Follow standard C++ syntax for respective relationship.

▪ How a class will interact in terms of C++ code with other class if it is inherited?

▪ How a class will interact in terms of C++ code with other class if it is aggregated?

▪ How a class will interact in terms of C++ code with other class if it is composed of?

▪ How we can access/use other class data members, member function for identified relationship?

Step 3: C++ Implementation of Attributes

▪ Your identified attributes will become class data members.

▪ Use standard notation of C++.

▪ Think about appropriate data types to define and declare your class data members.

▪ Before declaring it, think that whether this can be ‘constant data member’ or ‘static data member’. If not then why?

Step 4: C++ Implementation of Functions

▪ Your identified functionality will become class member’s functions.

▪ Use appropriate data types/return type to declare them.

▪ Also use standard notation of C++ for functions. You can take help from cs201 lecture which covers functions.

▪ Along with these identified member functions of classes there may be some setters and getters functions which must be implemented accordingly to ensure proper OOP philosophy.

▪ Constructors and destructor are must for each class; never ignore them while implementing other functionality. Think about copy constructers and overloaded constructors, they may be useful to you.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download