Quantcast
answersLogoWhite
notificationBell

Top Answer
User Avatar
Wiki User
Answered 2012-07-20 20:23:54

Function overriding applies to class member functions (methods), where a derived class provides a more specialised implementation of its generic base class method. An override can still call the base class method and augment it with other instructions (before or after the call to the base class method), or it can provide a complete implementation of its own without calling the base class method.

Classes that are intended to act as generic base classes will generally declare their methods to be virtual, meaning they are intended to be overridden, if required.

Abstract base classes will contain one or more pure-virtual methods (which may or may not provide a generic implementation), meaning classes must be derived from the abstract base class and all the pure-virtual methods must be overridden in the derived class (otherwise they, too, become abstract). Only classes that fully implement all the pure-virtual methods they inherit from their base classes can actually be instantiated. That is, you cannot instantiate an instance of an abstract base class, even if it provides generic implementations for all its pure-virtual methods. They can only be instantiated by deriving classes from them.

001
๐Ÿ™๐Ÿฟ
0
๐Ÿคจ
0
๐Ÿ˜ฎ
0
๐Ÿ˜‚
0
User Avatar

Your Answer

Still Have Questions?

Related Questions

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 function overridding in c plus plus?

Function overriding in C++ is when you declare and define a second function having the same name as the first function, but differing in the number and/or types of arguments. The compiler decides which function to call based on the signature of the arguments.


Is member function overriding allowed in C plus plus?

Yes, member function overriding in a derived class is allowed in C++, but only if the function is declared public or protected.Keep in mind that overridding and overloading are two different things, with overloading being the declaration and definition of two or more functions with the same name and scope, but with different numbers and/or types of parameters. Overloading is not related to derivation/overriding, so overloading is always allowed.


What is a primary function in C plus plus?

There is no such thing. You probably meant the main function. The main function is the only function that is required as it serves as the entry point of the program.


What are the building function in c plus plus?

There is no such term as "building function" in C++.


Function pointer in c plus plus?

Yes, C++ supports function pointers.


What is meant by println in c plus plus?

println is not a C++ keyword.


Can you use more than one main function in c plus plus?

No. You can only have one main() function in c/c++.


What is self referential function in c plus plus?

A self-referential function in C++, or in any other supporting language, is a recursive function.


What is a Generic Function in c plus plus?

Function templates are generic functions.


What is the only function all C plus plus programs must contain?

Every C plus plus program that is a main program must have the function 'main'.



Why is C plus plus called an object oriented programming language?

Any language that supports class types, private and protected data, inheritance, polymorphism, function overriding, virtual methods is regarded as an object oriented programming language. However, while C++ supports OOP, it does not rely on it. You can mix C++ and C-style code (non-OOP) in the same program.



What is a main function in c plus plus?

It is the first function that gets called when the program is executed.


What is the function of printf in c plus plus?

It's a function that print (something) on the terminal it's like (cout) function.


Input output function in c plus plus?

First of all, this is a C forum. C and C++ are -- yes, big shock -- different. Anyhow: the standard output function in C++ is std::cout, and the standard input function is std::cin.


Call by function in c language?

I guess you meant the following:'In C language, when you call a function,the parameters are passed by-value.'


What is a friend function in C plus plus?

A friend function in C++ is a function that is not part of the implementation of a class, i.e. not a method of the class, but that is allowed to manipulate the private parts of a class.


Friend function in c plus plus?

A friend function in C++ is a function that has privileged access to the members of a class that would normally not be granted by virtue of them being private or protected.


What is the function y equals ax2 plus bx plus c?

It is a quadratic function which represents a parabola.


What is function in C plus plus programming language?

a function is a code in braces to reduce the complexity of the program.


What is the function in c plus plus language?

function is a subprogram that acts on a data and often returns a value


What is the difference between overloading and overriding and polymorphism in terms of C plus plus?

Ploymorphism: It is the Object Oriented concept in which a single Object or function or variable is used in different forms. Overloading: polymorphism in which the same function name is used for different implementations with different parameter list or different types of parameters. Eg: To find the sum of integers, floats, double int sum(int, int); float sum(float, float); double sum(float, float); Note: if the retrun type is different the function is not overloaded but its a compilation error. Overriding: if a base class function is given a definitation in the derived class then this is called function overriding. Eg: class Base { int print() { System.out.println("Hello"); } } class Derived extends Base { int print() // overrides the function print in base class { System.out.println("Hi"); } } Note: in function overriding the drived class function's return type and the parameters should be the same as the base class function.



Still have questions?

Trending Questions
Previously Viewed
Unanswered Questions