Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mapping C++ virtual function to corresponding C function

Status
Not open for further replies.

anand102

Programmer
Aug 2, 2001
11
US
hi,

I have class A which has virtual fn xyz() and class C, class B extend class A.
i am converting this C++ code into C code. how should I map the virtual function xyz() in to C bcoz in C we dont have virtual function ??
Should i copy this function xyz() into to the C programs corresponding to Class B and class C ??


thanks
 
anand ,
i have already in my previous reply suggested
that there is no equivalent of c++ virtual functions in
c .reason c has only compile time binding while cpp
apart from compile time binding has run time binding
implemented by VTABLE AND VPTRS .

so for your task write different functions for
different c equivalent classes ,call those classes
with function ptrs or as you do in c

i hope it helps
regards
yogesh

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top