posted 21 years ago
If a base class has a method defined as
void method() { }
Which of the following are legal prototypes in a derived class of this class. Select the two correct answers.
A. void method() { }
OK. This is a legal override.
B. int method() { return 0;}
Invalid. You can't change the return type when you override a method.
C. void method(int i) { }
OK. Since the parameter list is different, method is being overloaded, not overridden.
D. private void method() { }
Invalid. You cannot narrow access to methods when overriding them.
[ March 03, 2003: Message edited by: John Paverd ]