Is it possible to run a polymorphism in C.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gaudwin
    New Member
    • Oct 2010
    • 1

    #1

    Is it possible to run a polymorphism in C.

    I want to run polymorphism in C any one can help me.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Polymorphism can be implemented in C by using function pointers. You will need to manage these pointers by yourself. C++ would do this for you so unless there is some technical reason you need to do this in C, you are really wasting a lot of your time re-creating code generated by a C++ compiler.

    I suggest you learn C++ polymorphism to see how C++ does it. Then just make your own C implementation that works for you.

    This is a nice exercise if you are a student. If this is for a real job, use C++.

    Comment

    Working...