You are given a base class box that defines a method foo() returning 0.
Implement a derived class whitebox that:
Overrides
foo()so that callingfoo()on awhiteboxinstance (even when it is referenced as abox) returns1instead of0;Overloads
foo()with a version that accepts a number and returns that number added by1.
You do not need to write any input/output parsing.
NOTE: The starter code is not necessarily complete. You are expected to edit it.
Example (cpp):
whitebox wb;
box& b = wb;
b.foo(); // returns 1 through the base reference
wb.foo(2); // returns 3 through the whitebox overloadAccepted 217/1,112
Acceptance 20%
Loading editor...
Input
OVERRIDEExpected output
1