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
Explain what is class definition in c++ ?
When do we use copy constructors?
How can you prevent accessing of the private parts of my class by other programmers (violating encapsulation)?
Why is polymorphism useful?
Is it possible to provide default values while overloading a binary operator?
Can user-defined object be declared as static data member of another class?
how to access grid view row?
What is a character in c++?
What is the difference between an external iterator and an internal iterator?
Describe delete operator?
What does ios :: app do in c++?
Please explain class & object in c++?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
What is a .h file c++?
What is searching?