LW_OOPC.H 面向对象C MISOO 头文件

Use Case(用例)的主要内涵及其表达为:

1)描述该服务的名称及返回的信息类型,她描述What

2)描述服务过程中,用户与系统之间有哪些交互,其描述How和When。但是请留意,这个How不是员工作汉堡的How,而是用户与系统如何交互的How。

3)描述用户的角色,她描述Who

/

动态型(Dynamic):使用malloc函数

静态型(Static):标准型;不用malloc,其对象不是在程序执行期间才去分配空间的。而是与一般的int,char形态的变量一样,在编译期间就留下内存空间了,不需要在执行期间通过malloc来取得内存空间。

纯粹静态型(pure STATIC)精简型;避免使用指针来调用函数。即不调用new函数。

/*  lw_oopc_kc.h */ 
#ifndef LOOPC_H 
#define LOOPC_H 
#include <malloc.h> 
#define CLASS(type)/ 
typedef struct type type; / 
struct type
#ifndef LW_OOPC_PURE_STATIC 
#ifndef LW_OOPC_STATIC 
#ifndef LW_OOPC_DYNAMIC
#define CTOR(type) / 
void* type##Setting(type*); / 
void* type##New() / 
       { / 
         struct type *t; / 
         t = (struct type *)malloc(sizeof(struct type)); / 
         return type##Setting(t); / 
       } / 
void* type##Setting(type *t) / 
      { 
    #else 
      #define CTOR(type) / 
      void* type##New() / 
      { / 
       struct type* t; / 
       t = (struct type*)malloc(sizeof(struct type)); 
    #endif
    #else 
    #define CTOR(type) / 
    void * type##Setting(type* t)/ 
    { 
        #endif 
        #endif
#define END_CTOR return (void*)t;  } 
#define FUNCTION_SETTING(f1, f2)  t->f1 = f2; 
#define IMPLEMENTS(type) type type 
#define INTERFACE(type) / 
typedef struct type type; / 
struct type 
#endif 
/*     end     */


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值