用C语言实现面向对象程序设计(一)

本文介绍了如何在C语言中实现面向对象编程,通过LW_OOPC的基础并简化为OOSM宏包,提供了不到30行的源代码示例,展示了C语言实现面向对象编程的低成本和优雅性。
摘要由CSDN通过智能技术生成

许多朋友都知道用C语言是可以实现面向对象程序设计的,但是具体到操作的细节部分就有些茫然不知所措了。为此作者在研究LW_OOPC的基础上,对其进行充分的简化,只保留最基本的面向对象功能,形成自己的OOSM宏包,其实这些东西已经够用了,以下是OOSM宏包的源代码:

/*
    Object-Oriented Support Macros(OOSM)

    OOSM is an object-oriented support macros, it makes the C programming language
    with object-oriented programming capabilities.

    LW_OOPC(http://sourceforge.net/projects/lwoopc/) means
    Light-weight Object-Oriented Programming in C, written by MISOO team,
    it is a very outstanding works!

    OOSM inherits the essence of LW_OOPC and crops to retain the basic features.
    OOSM written by Turingo Studio,
    but anyone can copies modifies, and distributes it freely.

    Hansome Sun(hansome.sun@gmail.com)
    January 18, 2013
*/
#ifndef __OOSM_H__
#define __OOSM_H__

#include <stdlib.h>

#define class(type)  
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值