What will happen to the program code if we declare an object of the parent class with the constructor of the child class? In other words, which constructor will be called: parent or child?
- oneUh, uh, uh. What is it called? I have already answered the first version of the question. How will my answer look now? :( - Igor
- Sorry, I made a typo in the text ( - Max
|
1 answer
(I adore riddles and quizzes.)
Will not compile.
(The new version of the question is not a hindrance to me.)
The question now looks something like this: "I call the child constructor. Which constructor will be called: child or parent?"
Answer: You call the child constructor. The child constructor is invoked. I hope that the parent constructor is called from it in your code.
- Yes, that's right: the question is exactly that - Max
- Thank you very much! - Max
|