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.
void update_val(int new_val)
{
while(val!=new_val)
{
// here get count that is equal to number of times
// you divide new_val by 2 and call so many times
// A::func(val)
A::func(val);
// here get count that is equal to number of times
// you divide new_val by 3 and call so many times
// B::func(val)
B::func(val);
// here get count that is equal to number of times
// you divide new_val by 5 and call so many times
// C::func(val)
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 →
void update_val(int new_val) { while(val!=new_val) { // here get count that is equal to number of times // you divide new_val by 2 and call so many times // A::func(val) A::func(val); // here get count that is equal to number of times // you divide new_val by 3 and call so many times // B::func(val) B::func(val); // here get count that is equal to number of times // you divide new_val by 5 and call so many times // C::func(val) C::func(val); }
}