C实现-CPP的-继承
来源:互联网 发布:大屏幕滚动抽奖软件 编辑:程序博客网 时间:2024/06/07 02:11
#include <stdio.h>#include <stdlib.h>struct Father {int num;void(*p_f)(struct Father * p);};void print_father(struct Father * p){ // 限定只能通过结构体来调用 printf("\n 爹给儿子留下了 %d元 人民币!" , p->num);}// --------------------- son struct Son {struct Father father; // 保留了一个对父类的引用 int num;void(*p_s)(struct Son * p);};void print_son(struct Son * p){printf("\n 儿子自己赚了 %d元 人民币!", p->num);}void main(){// init struct Son son;son.father.num = 1000; son.father.p_f = print_father;// callson.father.p_f(&son.father);//---------------son.num = 3000;son.p_s = print_son;son.p_s(&son);getchar();}
0 0
- C实现-CPP的-继承
- C实现-CPP的-封装
- C实现-CPP的-多态
- Cpp的继承Inheritance-笔记
- extern "C"----实现c cpp文件的混合编程
- 神奇的C&CPP
- C/Cpp的 typedef
- C语言链表的实现(修改版)Cpp文件
- c/c++头文件与cpp文件的切换实现
- 图邻接矩阵的c语言实现 graph_adj_matrix.cpp
- string.cpp的实现
- nms的cpp实现
- C实现面向对象的继承
- C#中继承的代码实现方法。
- 继承CHtmlView类的h 和cpp
- .C与.CPP的区别
- cpp和c的区别
- .c与.cpp的应用
- CentOS查看CPU、内存、网络流量和磁盘 I/O【详细】
- 删除链表中重复元素
- tomcat端口8080被占的处理方法
- C实现-CPP的-封装
- 黑马程序员-IO流学习笔记-1
- C实现-CPP的-继承
- C实现-CPP的-多态
- 十六进制Unicode编码字符串与中文字符串的相互转换
- 分类器之adaboost
- Matlab函数linspace简介
- [转]如何写出杀手级简历
- 对 CNN facial point detection[CVPR2013]一文的实现
- HBase 批量导入测试
- Java学习日记(十二)反射