Accessing Inherited Functions

Sort by

recency

|

263 Discussions

|

  • + 0 comments

    What an annoying task. The requirements are so not clear. Just copy the solution posted by @mft1998 and go on with your life.

  • + 0 comments

    What a useless website. Nobody is going to use this crap when there is leetcode where people are actually able to form proper sentences when asking a question.

  • + 1 comment

    I understand how to access the functions. Its not clear what is being asked.

  • + 1 comment

    This doesn't even make sense the "a" variable inside the "func()" of the A,B,C classes doesn't do anything since they have local scope. What's even the point of passing a variable into it?

  • + 0 comments
    class D : public A , B, C
    {
    	int val;
    	public:
    		//Initially val is 1
    		 D()
    		 {
    		 	val = 1;
    		 }
    		 //Implement this function
    		 void update_val(int new_val)
    		 {
                 while (val!=new_val)
                 {
                     if ((new_val/val)%2==0){A::func(val);}
                     if ((new_val/val)%3==0){B::func(val);}
                     if ((new_val/val)%5==0){C::func(val);} 
                 }
    		 }
    		 //For Checking Purpose
    		 void check(int); //Do not delete this line.
    };