C++ Programming - OOPS Concepts - Discussion

Discussion :: OOPS Concepts - General Questions (Q.No.32)


Which of the following concepts is used to implement late binding?

[A]. Virtual function
[B]. Operator function
[C]. Const function
[D]. Static function

Answer: Option A


No answer description available for this question.

Priyanka P said: (Jun 12, 2012)  
Late binding means dynamic binding and dynamic binding happen through the virtual keyword of function.

John said: (Sep 25, 2013)  
What is virtual function?

Hemanth Kumar said: (Dec 21, 2013)  
#include <iostream>
using namespace std;

struct A {
virtual void f() { cout << "Class A" << endl; }

struct B: A {
void f() { cout << "Class B" << endl; }

void g(A& arg) {

int main() {
B x;

Lingesh said: (Aug 3, 2014)  
Virtual function is declaring method in base class and redefining method in subclasses. So when we call a method, both classes contain same method but it will call the subclass method only.

Anitha said: (Dec 10, 2015)  
During compilation when the compiler encounters the keyword "virtual", then it postpones binding to some extent, which is called as late or dynamic binding.

Bholaram said: (Jun 23, 2016)  
Good explanation @Priyanka.

Shivank Gupta said: (Jun 23, 2020)  
Great answer, thanks @Anitha.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.