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 float in c++?
What is the use of lambda in c++?
What are the operators in c++?
What is the rule of three?
What is the fastest c++ compiler?
What is function overloading in C++?
Which programming language should I learn first?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
What is scope operator in c++?
What is cout flush?
What is array give example?
the first character in the variable name must be an a) special symbol b) number c) alphabet
Can you write a function similar to printf()?
Explain object slicing in c++?
What is class syntax c++?