CJCoding With Joseph

Hide Method With new

Sometimes a derived class replaces a NON-virtual base method by hiding it with the new keyword. Printer has a plain Print() that prints Base print. Add a Print() method to ColorPrinter using new so that it prints Color print. Do NOT write a Main method.

When the tester calls Print() on a ColorPrinter reference, the program prints:
Color print

Expected Output:

Color print
Topics:
Inheritance
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cw, cr, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.