1 #include<iostream> 2 using namespace std; 3 double balance[5] = {1000.0, 2.0, 3.4, 7.0, 50.0}; 4 class TEST{ 5 //基类 6 public: 7 int DATA[4][4]; 8 void Fun_Test(char a) 9 { 10 cout<<a<<endl; 11 } 12 13 }; 14 //类的继承 15 class TEST1:public TEST{ 16 17 }; 18 int main() 19 { 20 int temp; 21 TEST *p=new TEST;//定义一个对象指针,访问类公有成员 22 p->Fun_Test('P'); 23 temp=p->DATA[2][2]=5; 24 25 cout<<temp<<endl; 26 cout<<"class TEST1:public TEST"<<endl; 27 TEST1 test1;//定义一个对象 28 test1.Fun_Test('E'); 29 delete p;//释放 30 }
原文链接: https://www.cnblogs.com/qqfoxmail/p/11068952.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/297352
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!