point.c
来自「Object-Oriented Programming With ANSI-C这」· C语言 代码 · 共 33 行
C
33 行
#include <stdio.h>#include "Point.h"#include "Point.r"#include "new.h"#include "new.r"static void * Point_ctor (void * _self, va_list * app){ struct Point * self = _self; self -> x = va_arg(* app, int); self -> y = va_arg(* app, int); return self;}static void Point_draw (const void * _self){ const struct Point * self = _self; printf("\".\" at %d,%d\n", self -> x, self -> y);}static const struct Class _Point = { sizeof(struct Point), Point_ctor, 0, Point_draw};const void * Point = & _Point;void move (void * _self, int dx, int dy){ struct Point * self = _self; self -> x += dx, self -> y += dy;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?