⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 person.c

📁 c语言是面向过程的程序语言
💻 C
字号:
/* ****************************** * 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>/*---------------------------*//*   person implementation   *//*---------------------------*/#define IMPLEMENTATION#include <person.h>/*  ---------------------  Object implementation  ---------------------*/voidconstMethodDecl(print){  printf("name:\t%s\n", this->m.name);}BASEOBJECT_IMPLEMENTATION  methodName(print)ENDOF_IMPLEMENTATION/*  --------------------  Class implementation  --------------------*/initClassDecl() {} /* required */dtorDecl() /* required */{  free((void*)this->m.name);  this->m.name = NULL;}t_personclassMethodDecl_(*const new) char const name[] __{  t_person *const this = person.alloc();  if (this) person.init(this, name);  return this;}voidmethodDecl_(init) char const name[] __{  this->m.name = strdup(name);}voidmethodDecl_(copy) t_person const*const per __{  person._person(this);  person.init(this, per->m.name);}CLASS_IMPLEMENTATION  methodName(new),  methodName(init),  methodName(copy)ENDOF_IMPLEMENTATION

⌨️ 快捷键说明

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