education.c

来自「c语言是面向过程的程序语言」· C语言 代码 · 共 74 行

C
74
字号
/* ****************************** * Object Oriented Programming in C * * Author: Laurent Deniau, Laurent.Deniau@cern.ch * * For more information, please see the paper: * http://home.cern.ch/ldeniau/html/oopc/oopc.html * ****************************** */#include <stdio.h>/*------------------------------*//*   education implementation   *//*------------------------------*/#define IMPLEMENTATION#include <education.h>/*  ---------------------  Object implementation  ---------------------*/voidconstMethodDecl(print){  printf("\tdipl:\t%s\n", this->m.diploma);}BASEOBJECT_IMPLEMENTATION  methodName(print)ENDOF_IMPLEMENTATION/*  --------------------  Class implementation  --------------------*/initClassDecl() {} /* required */dtorDecl() /* required */{  free((void*)this->m.diploma);  this->m.diploma = NULL;}voidmethodDecl_(init) char const diploma[] __{  this->m.diploma = strdup(diploma);}voidmethodDecl_(copy) t_education const*const edu __{  education._education(this);  education.init(this, edu->m.diploma);}ABSTRACTCLASS_IMPLEMENTATION  methodName(init),  methodName(copy)ENDOF_IMPLEMENTATION

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?