[WEBINAR] The New Normal: Dealing with the Reality of an Unsecure World


Definition - What does Overriding mean?

Overriding is an object-oriented programming feature that enables a child class to provide different implementation for a method that is already defined and/or implemented in its parent class or one of its parent classes. The overriden method in the child class should have the same name, signature, and parameters as the one in its parent class.

Overriding enables handling different data types through a uniform interface. Hence, a generic method could be defined in the parent class, while each child class provides its specific implementation for this method.

Techopedia explains Overriding

The invoked method version is determined by the class object. If the child class object is used to invoke the method, then the child class version of the method is executed. If the parent class object is used to invoke the method, then the parent class version of the method is executed. The invoked method is determined at runtime, whereas in overloading, the invoked method is determined at compile time.

C++ and C# support overriding by explicitly using the keywords 'override' and 'virtual'. Java uses the 'super' keyword to invoke the superclass method. However, C++ does not have the super keyword and uses instead the base class name followed by the scope resolution operator (::).

Techopedia Deals

Connect with us

Techopedia on Linkedin
Techopedia on Linkedin
"Techopedia" on Twitter

Sign up for Techopedia's Free Newsletter!

Email Newsletter

Join thousands of others with our weekly newsletter

Free Whitepaper: The Path to Hybrid Cloud
Free Whitepaper: The Path to Hybrid Cloud:
The Path to Hybrid Cloud: Intelligent Bursting To Amazon Web Services & Microsoft Azure
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.