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.
I tried to extract the multiplication values from classes A, B, and C but in this case, the solution failed so I had to use the manual setting of the multiplication value, and I need to know that values:
//int mul_A{1}, mul_B{1}, mul_C{1};
//A::func(mul_A), B::func(mul_B), C::func(mul_C);
int mul_A{2}, mul_B{3}, mul_C{5};
while(0 == (new_val % mul_A)) {
new_val /= mul_A;
A::func(val);
}
while(0 == (new_val % mul_B)) {
new_val /= mul_B;
B::func(val);
}
while(0 == (new_val % mul_C)) {
new_val /= mul_C;
C::func(val);
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Accessing Inherited Functions
You are viewing a single comment's thread. Return to all comments →
I tried to extract the multiplication values from classes A, B, and C but in this case, the solution failed so I had to use the manual setting of the multiplication value, and I need to know that values: //int mul_A{1}, mul_B{1}, mul_C{1}; //A::func(mul_A), B::func(mul_B), C::func(mul_C); int mul_A{2}, mul_B{3}, mul_C{5}; while(0 == (new_val % mul_A)) { new_val /= mul_A; A::func(val); } while(0 == (new_val % mul_B)) { new_val /= mul_B; B::func(val); } while(0 == (new_val % mul_C)) { new_val /= mul_C; C::func(val); }