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

边栏推荐
- Understand MySQL index and b+tree in an easy to understand way (supreme Collection Edition)
- Sword finger offer 15. number of 1 in binary
- Leetcode skimming -- bit by bit record 017
- [SOC] the first project of SOC Hello World
- 2022 Tsinghua summer school notes L2_ 1 basic composition of neural network
- What are intelligent investment advisory products?
- 中信证券股票开户怎么样安全吗
- [Matplotlib drawing]
- The relationship between cloud computing and digital transformation has finally been clarified
- Using skills and design scheme of redis cache (classic collection version)
猜你喜欢

How to gracefully realize regular backup of MySQL database (glory Collection Edition)

Uniqueness and ordering in set

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

The relationship between cloud computing and digital transformation has finally been clarified
![[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

Leetcode skimming -- bit by bit record 017

Practical skills!!

Multiplication and addition of univariate polynomials

Ch single database data migration to read / write separation mode

Mathpix formula extractor
随机推荐
Detailed explanation of ThreadLocal
陈春花与莫言,都有苦难言
损失函数之Diou和Ciou loss
C synchronous asynchronous callback state machine async await demo
支付宝上股票开户安全吗
[jzof] 05 replace spaces
How to gracefully realize regular backup of MySQL database (glory Collection Edition)
CAD calls mobile command (COM interface)
Node installation using NVM succeeded, but NPM installation failed (error while downloading, TLS handshake timeout)
Experience of using dump file to reverse locate crash location
Go language pack management
IO flow overview
Overloaded & lt; for cv:: point;, But VS2010 cannot find it
驱动子系统开发
Makefile基础知识--扩展
Mathpix formula extractor
Es+redis+mysql, the high availability architecture design is awesome! (supreme Collection Edition)
How do test / development programmers survive the midlife crisis? You can see it at a glance
图像处理笔记(1)图像增强
2022 Tsinghua summer school notes L2_ 1 basic composition of neural network