190k views
1 vote
If the derived class does not override a public member function of the base class, you may specify a call to that public member function by using the name of the function and the appropriate parameter list. True or False?

1 Answer

5 votes

Answer:

The answer to this question is "True".

Explanation:

The term function overriding is a part of the object-oriented programming language. The overriding refers to override the method which is defined in the base class for override the same method we use the inheritance.

In overriding if a derive class(child class) does not allows us to override a function to there base class (parent class).So, we call this method in main method.

For example:

#include <iostream> //header file.

using namespace std;

class base //define class base.

{

public:

void display(string s) //define method display.

{ //method body.

cout<<"hello.."<<s; //print value.

}

};

class child:public base //define class child that inherit base class

{

public:

void display(string s) //override method display.

{

cout<<"Hii....!"<<s; //print value.

}

};

int main() //main method.

{

string s="XXX";

child ob; //create child class object.

ob.display(s); //call method.

return 0;

}

Output:

Hii....! XXX

That's why the answer to this question is "True".

User Plancke
by
4.8k points