We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
// class D inherit classes A, B and CclassD:publicA,B,C// Calls class specific func impl by using class scope resolution// Rest is maths voidupdate_val(intnew_val){intfactor=1;while(new_val!=1){factor=!(new_val%5)?5:!(new_val%3)?3:2;switch(factor){case5:C::func(val);break;case3:B::func(val);break;default:A::func(val);break;}new_val=new_val/factor;}}
Accessing Inherited Functions
You are viewing a single comment's thread. Return to all comments →
A cleaner solution :
couldn't squeeze it down further.