what is virtual function?

Answer Posted / aarti ashar

A virtual function is a function member of a class,
declared using the "virtual" keyword. A pointer to a
derived class object may be assigned to a base class
pointer, and a virtual function called through the pointer.
If the function is virtual and occurs both in the base
class and in derived classes, then the right function will
be picked up based on what the base class pointer "really"
points at.

Is This Answer Correct ?    25 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can static class have constructor?

583


What is encapsulation with real life example?

570


Which method cannot be overridden?

578


Why is abstraction used?

603


What is pointer in oop?

535






Can enum be null?

586


why reinterpret cast is considered dangerous?

1900


class type to basic type conversion

1835


What is the real time example of encapsulation?

595


What is methods in oop?

540


Explain the advantages of inheritance.

672


Can we define a class within the interface?

553


Why polymorphism is used in oops?

582


What is encapsulation oop?

575


#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2164