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

Can we define a class within the interface?

551


Why do we use class?

633


Why do we use polymorphism in oops?

575


What is the difference between static polymorphism and dynamic polymorphism?

579


What is abstraction with example?

599






What is the importance of oop?

605


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1145


#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

2159


What type of loop is a for loop?

682


What are the 3 principles of oop?

614


What does I oop mean?

611


What is encapsulation process?

575


What is object-oriented programming? Webopedia definition

717


Why is oop useful?

600


Write a program to reverse a string using recursive function?

1788