after that it comes to Derived class constructor again there is a call to addValue() method again it will call addValue() method of Base class(not Derived addValue() because object is not at all existed for Derived class as we are in Derived class constructor.)
All the super classes(chained ones) of the subclass will be initialized before subclass instance is created.
If Parent class method isn't overridden in the Child class, then that Parent class method is invoked at run-time for the instance of Child class too!
Originally posted by madhu v pe:
when base class reference is pointing to Derived class object, if derived class is overloading base class method, always base class method will be called.
simply overloading method calling depends on the Base class
overriding method calling depends on the Derived class
Originally posted by Raghavan Muthu:
Can you just explain the invocation steps (8 statements) you had given?
You firghten me terribly. I would like to go home now. Here, take this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database