CS304 Assignment No. 3

No Comments

Object Oriented Programming (CS304)

Assignment No.03 

Total Marks                 10

Deadline

Your assignment must be uploaded before or on 14th June, 2011.

Rules for Making

It should be clear that your assignment will not get any credit if:


o        The assignment is submitted after due date
o        The assignment is copied

Objectives

This assignment has been designed so that you would be able to implement the concept of Inheritance in OOP. After the completion of this assignment you should have a good grasp on how to implement.

o        Inheritance
o        Public & private inheritance
o        Using basic constructs of OOP in a program

In previous assignments we have understood all the basics of the Content Management System including the Object Model Diagram and highlighted the Abstraction of classes in terms of attributes and functions prototype. Now it is time to implement the full system in parts, so this assignment is first step towards it (there will be one more assignment also).

Assignment:
In this assignment you have to code/implement the below said classes in running form these classes are,

·         Topic
·         Sub Topic


Meaning after completion of this assignment your c++ program will be able to

1.   Add/Edit/Remove Topics
2.   Search/ View Topic
3.   Print/Download Topic

Now for implementing these two classes practically in c++ you have to define classes according to the requirements (solution of second assignment) given below, each class will have some attributes and functions that needs to be implemented in reality.

Note: You may add some more attributes and functions in any of the class but already given attributes and functions will be at least in your solution file.

class topic{ // topic class
   
    //topic class attributes
    // Access specifier is by default private
    int ID;       
    char * title;    

    public: // public access specifier

    // topic class functions/ operations   
    void add();
    void remove();
    bool select();
    void search();
    void View();
    void print();
    void download();
    };// end of topic class
   
// ********************************************************************
// ********************************************************************
// ********************************************************************  

   
class SubTopic: public topic {   // Inheritance relationship b/w topic and sub topic
     // Attributes of SubTopic class
     // Access specifier is by default private
     int SubID;
   
    };

Furthermore, you are required to introduce the implementation of constructor, destructor and implementation of getter and setter functions in classes in such a way that, 
The ‘SubTopic’ class restrict the functionality of setTitle() function by override the setTitle() function of its base class‘Topic’ and check the condition:

If the “title” has a paragraph text (length) then prints that “Eligible for being a Topic Title”.

 If object of “SubTopic class is initialized with no paragraph length, then it prints a message

Title just contain name and there is no description” and sets the value of title to default.

Important Note:

This is just starting code for demonstrating how Inheritance can be implemented you can add as much details as you like.

Uploading Instructions:
You have to upload your running zipped Dev c++ project. 
Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment