I have a couple problems here that I have answered. I am not 100% sure of my answer(s). Would you be so kind as to check them and provide suggestions if they are not correct. These 2 questions are regarding what methods super/sub class(es) can invoke (question1) and which objects invoke which methods (question2). Thanks in advance.
Question 1 ================================================== Super Class: Expression (Includes prefix, postfix, and infix expressions) Public Method: characterAt Protected Method: isOperator Protected Method: isIdentifier Private Method: somePrivateMethoda Private Method: somePrivateMethodb
SubClass: InfixExpression (Derived from Expression. Represents infix expression) Public Method: isLegal Public Method: evaluate Protected Method: someProtectedMethoda Protected Method: someProtectedMethodb Private Method: anotherPrivateMethoda Private method: anotherPrivateMethodb ================================================== What methods can the implementation of isIdentifier invoke? CharacterAt isOperator somePrivateMethoda somePrivateMethodb
What methods can the implementation of isLegal invoke? characterAt isOperator isIdentifier evaluate someProtectedMethoda someProtectedMethodb anotherPrivateMethoda anotherPrivateMethodb
Question 2 Assuming the classes described in the previous question and consider a main method that contains:
Expression algExp; InfixExpression infixExp;
Soooo... ================================================== Super Class: Expression (Includes prefix, postfix, and infix expressions) Main Method: algExp Public Method: characterAt Protected Method: isOperator Protected Method: isIdentifier Private Method: somePrivateMethoda Private Method: somePrivateMethodb
SubClass: InfixExpression (Derived from Expression. Represents infix expression) Main Method: infixExp Public Method: isLegal Public Method: evaluate Protected Method: someProtectedMethoda Protected Method: someProtectedMethodb Private Method: anotherPrivateMethoda Private method: anotherPrivateMethodb ================================================== Whic h of these objects can correctly invoke the method CharacterAt? algExp and infixExp
Which of these objects can correctly invoke the method isOperator? algExp and infixExp
Which of these objects can correctly invoke the method isLegal? infixExp