What does it mean to declare a member function as virtual in C++?



What does it mean to declare a member function as virtual in C++?..

Answer / Md. Nadir Wahab

"Declaring a member function as virtual in C++ allows the function call to be resolved at runtime rather than compile-time. When using polymorphism, the derived class version of the virtual function gets called if an object of the base or derived class is used to call it."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ Interview Questions

Write a program that ask for user input from 5 to 9 then calculate the average

1 Answers   IBS,


Explain about Searching and sorting algorithms with complexities

1 Answers   Accenture,


There is a base class sub, with a member function fnsub(). There are two classes super1 and super2 which are sub classes of the base class sub.if and pointer object is created of the class sub which points to any of the two classes super1 and super2, if fnsub() is called which one will be inoked?

1 Answers   Alter,


What's the value of the expression 5["abxdef"]?

1 Answers  


In C++ what is the meaning of data hiding?

1 Answers   Aricent,


dynamic scoping is

1 Answers   Siemens,


Write a program to display the following output using a single cout statement Maths=90 Physics=77 Chemistry = 69

2 Answers  


How does stack look in function calls? When does stack overflow? What can you do to remedy it?

1 Answers   Adobe,


Without using third variable write a code to swap two numbers.

1 Answers   Accenture,


What is an abstract class?

6 Answers   Siemens,


What are the major differences between C and C++?

1 Answers   Amazon,


What Is Polymorphism in C++ ?

3 Answers   IBS, Impetus, ITC Indian Tobacco Company, Motorola,


Categories