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.
Hello there here's a hint to get you to the answer yourself at one go:
In this problem we are only required to call the func of A, B, and C if it is divisible by 2, 3 and 5.
you dont have to do anything else you just make functions to call them when the number is divisible by
there are multiple ways to do it
steps:
1: inherit the classes
2 use while to check value is greater than value
3rd in while loop you can either create multiple if-else-if ladder to check divisibility and call function
catch here: you can also use this pointer
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 →
Hello there here's a hint to get you to the answer yourself at one go: In this problem we are only required to call the func of A, B, and C if it is divisible by 2, 3 and 5. you dont have to do anything else you just make functions to call them when the number is divisible by
there are multiple ways to do it steps: 1: inherit the classes 2 use while to check value is greater than value 3rd in while loop you can either create multiple if-else-if ladder to check divisibility and call function
catch here: you can also use this pointer