当前位置:网站首页>[combination of classes (define a class in a class)]
[combination of classes (define a class in a class)]
2022-07-24 21:36:00 【Li is struggling】
【 Class : Class name A object 】
( Object name ()) Not a class name

#include <iostream>
#include <string.h>
using namespace std;
class Person
{
private:
string name;
string sex;
int age;
public:
Person(string na, string se, int ag) :name(na), sex(se), age(ag) {}
Person() {}
~Person() {}
void show()
{
cout << " full name , Gender , Age is :" << name << " " << sex << " " << age << " " << endl;
}
};
class Student
{
private:
int gress;
Person p;
public:
Student(string na = " Li Ming ", string se = " male ", int ag = 20, int gr = 11) :p(na, se, ag), gress(gr) {}
void show()
{
p.show();
cout << " The level of :" << gress << endl;
}
};
int main()
{
Student s;
s.show();
return 0;
}

边栏推荐
- 图像处理笔记(1)图像增强
- [crawler knowledge] better than lxml and BS4? Use of parser
- 2022 Tsinghua summer school notes L2_ 1 basic composition of neural network
- Uniqueness and ordering in set
- What should I do when selecting the RDS instance access method?
- Node installation using NVM succeeded, but NPM installation failed (error while downloading, TLS handshake timeout)
- 中信证券股票开户怎么样安全吗
- With this PDF, I successfully got offers from ant, jd.com, Xiaomi, Tencent and other major manufacturers
- Overloaded & lt; for cv:: point;, But VS2010 cannot find it
- [verification of ID number]
猜你喜欢

陈春花与莫言,都有苦难言

Leetcode skimming -- bit by bit record 018

Day5: three pointers describe a tree

【类的组合(在一个类中定义一个类)】
![[jzof] 05 replace spaces](/img/af/62432e0d6310d575a54e9409da0c32.png)
[jzof] 05 replace spaces

Shell introduction and variable definition

Lenovo Filez helps Zhongshui North achieve safe and efficient file management

Alibaba cloud and parallel cloud launched the cloud XR platform to support the rapid landing of immersive experience applications

91. (leaflet chapter) leaflet situation plotting - offensive direction drawing

Using skills and design scheme of redis cache (classic collection version)
随机推荐
[jzof] 05 replace spaces
90% of people don't know the most underestimated function of postman!
How about Urumqi Shenwan Hongyuan securities account opening? Is it safe?
C synchronous asynchronous callback state machine async await demo
Which bank outlet in Zhejiang can buy ETF fund products?
Codeforces Round #808 (Div. 2)(A~D)
Selenium test page content download function
微信小程序监听实时地理位置变化事件接口申请
String matching (Huawei)
Makefile基础知识--扩展
The relationship between cloud computing and digital transformation has finally been clarified
Maxcompute instance related operations
Make good use of these seven tips in code review, and it is easy to establish your opposition alliance
One bite of Stream(6)
[development tutorial 6] crazy shell arm function mobile phone - interruption experiment tutorial
Understand MySQL index and b+tree in an easy to understand way (supreme Collection Edition)
ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)
MySQL - multi table query - seven join implementations, set operations, multi table query exercises
A very useful log4net logging library
Uniqueness and ordering in set