Pramod Kumar Pandey wrote:Sir but when we are not creating the child object then how it will call the Child constructor ?
You may not be creating a Child instance in this particular piece of code but there may be other code in other files that does create a Child instance.
After all, what's the point of defining the Child class if you're never going to create an instance of it (or a subclass of it) ?