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
Who discovered c++?
What is the two main roles of operating system?
Difference between declaration and definition of a variable.
Can a constructor return a value?
What is static in c++?
Explain stack & heap objects?
What is the benefit of c++?
How is c++ different from java?
How delete [] is different from delete?
What kind of jobs can I get with c++?
How to access a variable of the structure?
What does catch(…) mean?
What are the advantages of c++? Explain
What is the difference between global int and static int declaration?
What is a friend function in c++?