Page 1 of 1

question on objects

Posted: Thu Jan 12, 2017 6:08 am
by sulakshana
If a question asks new parkRanger().notenewoffspring(_______)
What type of answers will match the blank in above......is it subclass or superclass or how to judge a question like this..

Re: question on objects

Posted: Thu Jan 12, 2017 12:03 pm
by admin
You can always pass a subclass object where the parameter type is a super type. You will need to go through a good book to understand the topic of polymorphism to answer such questions.