Accessing Inherited Functions

  • + 0 comments
       //Implement this function
        void update_val(int new_val)
        {
            while (new_val > 1) {
                if ((new_val % 2) == 0) {
                    A::func(val);
                    new_val *= 0.5;
                }
                if ((new_val % 3) == 0) {
                    B::func(val);
                    new_val /= 3;
                }
                if ((new_val % 5) == 0) {
                    C::func(val);
                    new_val *= 0.2;
                }
            }
        }
    	//For Checking Purpose
        void check(int); //Do not delete this line.
    };