类的对象用法

/*
class name
{
int a;
int b;
int c;
};
//
int main() //还不会用的一些技巧
{
string name; //string 是类
name ="hello";
cout << name.size()<< endl; //strlen
string cin;
cin.getline(name,5);
cout << name.c_str() <<endl;
cout << name.end() <<endl;

}
//-------------------------

strcpy(地址,串)
strcat(旧串,附加穿)
strcmp(串1,串2)
getline 。。。。。。。。。。。会生成一个包含一串从输入流读入的字符的字符串,直到以下情况发生会导致生成的此字符串结束
*/

//无名对象 类 (数);
//继承:class Child :public person{};
//覆盖,子类中含有和父类同名函数时,覆盖父类的函数。
//多重继承:子类继承所有父类函数。 class child :public person,public men{}
//虚继承 class child :virtual person{}
//写一个无法继承的类、(需要用到友元函数)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

友情链接更多精彩内容