CP1300 C++ Inheritance and Overloading

(Sections 8.4)
Last modified Wednesday, 18-Oct-2000 22:19:34 UTC.

Inheritance

Overloading


Self assessments


Tutorial Questions


Exam style questions

  1. In a derived class:
  2. Given the following base class header file, write the header file for a derived class that adds an integer data member, and provides a function that increments that integer.
    //------------------------------------------------------
    #ifndef BASICCLASS_H
    //------------------------------------------------------
    class basic {
    
    public:
    
    basic(void);
    
    int PlayBasicStuff(int Something);
    
    private:
    
    char BasicData;
    
    };
    //------------------------------------------------------
    #define BASICCLASS_H
    #endif
    //------------------------------------------------------
    
  3. Write the implementation file for the derived class defined in the last question.
  4. What is meant by overloading?
  5. How does a C++ compiler differentiate between overloaded functions.
  6. Write the header for a class that uses overloading (use your imagination for what the class does).