C对象化
C++有编译器帮助,对象通过this体现;
C语言只能靠自己,一般第一个参数就是对象,例如int wake_up_process(struct task_struct *p)
面向对象的好处:
不用考虑与对象无关的状态;
有利于单元测试。
OOD:面向对象分析和建模,不过时。
特殊的对象,通过派生类解决。例如:
struct animal {
enum type;
funcBark bark;
void *extension; =>弱类型,可以强转
}
object-oriented-programming-with-ansi-c
https://ishare.iask.sina.com.cn/f/21860701.html
https://www.getfreeebooks.com/object-oriented-programming-with-ansi-c/