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 .lib file in c++?
What is data abstraction? How is it different from data encapsulation?
What is ctime c++?
What is constant in c++ with example?
Is map ordered c++?
What is set in c++?
Explain the auto storage classes in c++.
If all is successful, what should main return a) 0 b) 1 c) void
How the keyword struct is different from the keyword class in c++?
Which bit wise operator is suitable for turning off a particular bit in a number?
What is the c++ code?
Differentiate between a template class and class template in c++?
How much maximum can you allocate in a single call to malloc()?
What are the syntactic rules to be avoid ambiguity in multiple inheritance?
What is the operator in c++?