正在加载图片...
1.C艹+语言的面向对象特征 class Base protected privat nt prl 1 nt pub mem Base(int y, int m, int d): pub mem(y), pro mem (m), pri_ mem(d)0 class Pub Son: public Base public Pub Son(int a, int b, int c): Base(a, b, c) /合法,输出10 d f1 o << pub mem < endl Base b2(40,50,60); cout b2 pub mem < endl //非法,派生类的对象不能访问继承来的保护成员 cout < b2 pro mem < endl /合法,输出10 void f2 cout < pro mem < endl /非法,派生类不能访问继承来的私有成员 id f30 cout < pri n1. C++语言的面向对象特征
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有