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.
Accessing Inherited Functions
Accessing Inherited Functions
Sort by
recency
|
273 Discussions
|
Please Login in order to post a comment
This exercise basically asks you to complete the class D and the method update_val(new_val) so that when the method gets called: 1. The value of val is set equal to new_val 2. The method computes how many times each method func of classes A, B, C needs to be called to construct the value new_val as the product of the prime numbers 2, 3, 5. Every time A::func gets called, the prime number 2 is counted up, B::func the prime number 3, and so on. So 30 = 2 x 3 x 5 so each func must be called once. For something like 90 = 2x3x3x5 you need to call A::func, B::func, B::func, C::func. And so on...
I spent more time trying to understand what "exactly" they are asking for than actually coding. Very ambiguous and defeats the whole purpose of writing code.
"Implement class D's function update_val. This function should update D's val only by calling A, B and C's func."
but you have to modify the class...
horrible exercise