当前位置:网站首页>[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;
}

边栏推荐
- Big country "grain" policy | wheat expert Liu Luxiang: China's rations are absolutely safe, and the key to increasing grain potential lies in science and technology
- Maxcompute instance related operations
- 损失函数之Diou和Ciou loss
- [shallow copy and deep copy], [heap and stack], [basic type and reference type]
- Lenovo Filez helps Zhongshui North achieve safe and efficient file management
- Prefabricated financial voucher Bapi
- 驱动子系统开发
- Information System Project Manager - Chapter 10 project communication management and project stakeholder management
- 2022 Tsinghua summer school notes L1_ NLP and bigmodel Foundation
- Is it safe to open an account on Alipay
猜你喜欢

Case analysis of building cross department communication system on low code platform

2022 Tsinghua summer school notes L2_ 2 basic introduction of CNN and RNN

Gather relevant knowledge points and expand supplements

ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘ (10061)

C # image template matching and marking

Redis (12) -- redis server

APR learning failure problem location and troubleshooting
![[Development Tutorial 4] open source Bluetooth heart rate waterproof sports Bracelet - external flash reading and writing](/img/cf/db40dcbb141c5a2e8ccaed7700fa3e.png)
[Development Tutorial 4] open source Bluetooth heart rate waterproof sports Bracelet - external flash reading and writing

Sqlserver BCP parameter interpretation, character format selection and fault handling summary

Rce (no echo)
随机推荐
Summary of yarn capacity scheduler
Brand new: the latest ranking of programming languages in July
rogabet note 1.1
A simple method of converting SVG to PDF
01_ UE4 advanced_ PBR material
[Matplotlib drawing]
[CCNA experiment sharing] routing between VLANs of layer 3 switches
MQ release confirmation
90% of people don't know the most underestimated function of postman!
陈春花与莫言,都有苦难言
Experience of using dump file to reverse locate crash location
Overloaded & lt; for cv:: point;, But VS2010 cannot find it
Summary of communication with customers
Which type of database migration is suitable for choosing the self built database access method on ECs?
Drawing library Matplotlib styles and styles
Drive subsystem development
Mysql database commands
Jenkins introduction
HSPF (hydraulic simulation program FORTRAN) model
91. (leaflet chapter) leaflet situation plotting - offensive direction drawing