C++ 有许多features( abstract class, virtual deconstuctor,RTTI, virtual inheritance)完全用C 去模拟一个C++ 其实是很难。

下面列一个表,如何用C 去模拟C++的一些主要功能:

Feature in C++  Implemented in C
 Class  structure
      data member          data member
      static_ data member         global member and link
      membor function         function point
      constructor function         global access entry
      destructor  function         x
      access decorator          x
 Inheritance  Composit
 Ploymorphism  Overwite the function point
RTTI

 OK

下面一个例子来自于 codeproject:

http://www.codeproject.com/KB/cpp/InheritancePolymorphismC.aspx

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
猜你喜欢
  • 2021-06-12
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案