愿你出走半生,归来仍是少年。
May 10, 2018点击
用对象指针引用对象数组
123456789101112131415161718192021222324
#include<iostream.h>//using namespace std;class A{int x;public:void set_x(int a){x=a;}void show_x(){cout<<x<<endl;}};main(){A *ptr,ptr1[2];ptr1[0].set_x(12);ptr1[1].set_x(22);ptr=ptr1;ptr->show_x();ptr++;ptr->show_x();return 0;}
原文作者: 赖卓成原文链接: https://lzcxfz.github.io/2018/05/10/用对象指针引用对象数组/版权声明: 转载请注明出处(必须保留作者署名及链接)
原文作者: 赖卓成
原文链接: https://lzcxfz.github.io/2018/05/10/用对象指针引用对象数组/
版权声明: 转载请注明出处(必须保留作者署名及链接)