Can we have a private virtual method ?

Answer Posted / nk

We can have virtual functions as long as we dont call the
function from a base pointer pointing to the base
class/derived class.

If we call then gives error.

The same error can be tested by compiling and running above
example.

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What type of loop is a for loop?

682


Can destructor be overloaded?

595


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1403


Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2575


Is data hiding and abstraction same?

567






Is enum a class?

604


What is Difference Between Inheritance and creating object and getting data? means Class A extends B{ B.getMethod();} (OR) Class A{ b obj=new B(); obj.getMethod(); }

1981


What is polymorphism programming?

601


What is encapsulation oop?

574


What is static modifier?

630


What is polymorphism give a real life example?

557


How to use CMutex, CSemaphore in VC++ MFC

4328


what are the different types of qualifier in java?

1840


What is abstraction example?

618


What is encapsulation with example?

578