What are Virtual Functions? How to implement virtual
functions in "C" ?
Answer Posted / jaroosh
To address the second part of the question - the only way to
implement mechanism like virtual functions in C is by using
function pointers, creating structure emulating Virtual
Pointer Table etc.
Implementation is rather complicated and creates a lot of
overhead for every structure that we want to use with
virtual functions (since ANSI C doesnt support inheritance
and polimorphism, it also calls for emulating this behavior,
so virtual functions for C is actually more of a form of art
than anything usefull).
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
What is a friend function in c++?
Difference between declaration and definition of a variable.
Explain what data encapsulation is in c++?
How to declare a function pointer?
What is the use of string in c++?
Mention the ways in which parameterized can be invoked. Give an example of each.
What are 2 ways of exporting a function from a dll?
How do you establish an is-a relationship?
What does int * mean in c++?
Explain terminate() and unexpected() function?
Is c# written in c++?
What are static member functions?
What is the history of c++?
Can a new be used in place of old mallocq? If yes, why?
By using c++ with an example describe linked list?