摘要
已有前人提出用C语言实现面向对象的方案,但它们都需要开发者人为提供支持面向对象的C语言框架,增加了开发者的负担。该方案用类C++语法编写初始代码,享受面向对象特性,而内部把初始代码自动转换成为支持面向对象特性的C代码,实现了面向对象理念和C语言的无缝对接。文章解析了用C语言实现面向对象的机制及代码转换机制,对比该方案和C++编程的效果,证实该方案的优越性。
There are already solutions to make C language support Object-Oriented feature, but in those solutions the code framework supporting that feature needs to be provided by developers. In this solution codes will be written in C++-like grammar, while inside codes will be converted into Object-Oriented C language code, so no gap between Object-Oriented feature and C language exists. This paper analyzed the mechanisms of supporting Object-Oriented feature by using C language and codes converting, and then compared performance of this solution to that of using C++, so its advantage would be proved.
作者
饶俊文
朱宏明
RAO Jun-wen, ZHU Hong-ming (Software School, Tongji University, Shanghai 201804, China)
出处
《电脑知识与技术》
2008年第12Z期2181-2183,2187,共4页
Computer Knowledge and Technology