answersLogoWhite

0


Best Answer

When a class inherits from another class, it is implicitly given all the functions of its parent class. For example, if we have a class foo which has functions f1 and f2, and we write another class zed which inherits from class foo, we can call the function zed.f1 or zed.f2, without having to write them again. Effectively, the code for f1 and f2 are copied from foo into bar.

Overriding is when you want zed.f1 to do something other than what foo.f1 does. By re-writing f1 in zed, we change what it does in zed without changing what it does in foo.


This becomes important when we start talking about abstraction. In well-designed object-oriented languages, we can use child classes in place of their parents. For example, if we have yet another class bar that performs operations on a foo, we could give it a zed instead and it would still work, because zed must have all the functions that foo does.

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is overriding inheritance?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Computer Science

What are the advantages of multiple inheritance over single inheritance?

The advantages of multiple inheritance over single inheritance include being a realistic software model. It is useful in breaking down complicated behavior into sets of characteristics that does not interfere with one another.


When making hardware decisions the overriding considerations of a business should be technology cost and currency?

True


Advantages of frame based expert systems?

Frame-based systems support class inheritance, i.e. the process by which all characteristics of a class-frame are assumed by the instance-frame.


What is the purpose of declaring abstract method?

Abstract Class: The class which contains the common features of components of several classes, but cannot it be instantiated by itself. It represents an abstract concept for which there is no actual existing expression. For instance, "Vegetation" is an abstract class - there is no such real, real thing as generic vegetation. Instead, there are only instances of vegetation, such as mango tree and rose plant, which are types of vegetation, and share common characteristics, such as having leaves and stem in at least part of the lifecycle. SO in software engineering, an abstract class is a class in a nominative type system which is declared by the programmer, and which has the property that it contains members which are also members of some declared subtype. In many object oriented programming languages, abstract classes are known as abstract base classes, interfaces, traits, mixins, flavors, or roles. Note that these names refer to different language constructs which are (or may be) used to implement abstract types. We can also say that abstract class is : -- A class which is used only as an ancestor and is never instantiated. In other word a concrete definition will say that A type of class with pure virtual member functions and one or more methods that are declared but not implemented, that behaves as a base class but prohibits the instantiation of any members of that class. i.e. It has a complete interface but only a partial implementation It is used to take advantage of inheritance yet prohibiting the generation of objects that are not completely defined. Concrete subclasses of an abstract class are required to flesh out the implementation by overriding the abstract methods.


What are the size factors in software engineering?

1.Population:By taking a static count of Object Oriented Entities,exa:Classes and Operations. 2.Volume:The Population measured but are collected dynamically at given instance of time.(the poulation may be changed after multiple uses of diferent entities so its called Dynamically) 3.Length:A chain of interconnected design elements such as :inheritance tree with its length. 4.Functionality:indirect indication of the value delivered by aplication.(software size depends on user is required functionality of application or a Software

Related questions

Is it possible to implement method overriding in each and every type of inheritance?

Yes. Method Overriding is not possible without inheritance and it can be done in all possible types of inheritance.


Is it possible to implement method overriding every type of inheritance?

yes if larry has a mustache


Is it possible to implement overriding in every inheritance?

Yes. It is possible to implement overriding in every inheritance level. If there are methods of the same name in multiple classes in the hierarchy the one that is closest to the current object gets invoked. The other methods can be specifically invoked using the super keyword.


Example of overriding in java?

For example: class Speak { void SayHello(){}; } class Boy extends Speak { void SayHello(){System.out.println("I'm a boy");} } So overriding is usual to rewrite the motheds in subclasses .In subclsses ,you can override the methods acceded from his parent class.


Why can't method override be used without inheritance?

Overriding a method means that you are replacing an existing or virtual method that has already been defined in the parent object class, so without using inheritance, there can be no existing method to override.


Make a sentence with the word overriding?

Your safety is our overriding consideration.


Difference between inheriting a method and overriding?

Inheriting a method means - a class is able to use a method that is declared in its parent class. Because of inheritance we need not re-declare the method in the child class again but still use it as it is. Overriding means re-declaring a method that is already available in the parent class in the child class to alter its features as per the requirement in the child class.


What is the advantages of overriding?

Overriding is a feature that is available while using Inheritance. It is used when a class that extends from another class wants to use most of the feature of the parent class and wants to implement specific functionality in certain cases. In such cases we can create methods with the same name and signature as in the parent class. This way the new method masks the parent method and would get invoked by default.


Is overriding a dynamic polymorphism in c plus plus or not?

In C++, overriding and function, method, or operator is a different thing than (dynamic) polymorphism, so overriding a polymorphic method is almost entirely possible.


What is the opposite of overriding?

The opposite of the gerund overriding would be approving or endorsing.(In the US Congress, the failure to override a veto is confirming it.)The adjective overriding (meaning of primary importance, overarching) has the opposites secondary, insignificant, negligible, or unimportant.


What was first boycott was overriding on?

blacks


How can you end a veto?

by overriding the veto