The "Big Five" Exercises

  < Previous  Next >
  1. What are the "Big Five"?
  2. In general, when it is required to use the "Big Five" (instead of the defaults)?
  3. Given the declaration of the SimpleDoubleHolder class, write:
    1. Constructor (with optional argument)
    2. The names and the function prototypes for each of the "Big Five"

    bigFiveExercises.cpp:
    #include <iostream>
    #include <string>
    using std::string;
    using std::cout;
    
    class SimpleDoubleHolder{
    public:
        // 1) Constructor (with optional argument)
        
        // 2) Include the "Big Five" here
        // 2a) 
        
        // 2b) 
        
        // 2c) 
           
        // 2d) 
        
        // 2e) 
            
        void setDouble( double value);
        void printDouble();
        
    private:
        double* m_DoublePtr;
    };
    
    void SimpleDoubleHolder::printDouble(){
        cout << "m_DoublePtr: ";
        if( m_DoublePtr == nullptr){
            cout << "nullptr\n";
        }else{
            cout << *m_DoublePtr << "\n";
        }
    }
    
    
    // setter for data member
    void SimpleDoubleHolder::setDouble( double value){
        m_DoublePtr = new double( value);
    }
    
    
    // Constructor (with optional argument)
    
    
    

Last Modified: