課程
/后端開發(fā)
/C++
/C++遠(yuǎn)征之封裝篇(上)
老師調(diào)用拷貝函數(shù)用的是棧的方式,用堆的方式該怎么做?
2019-08-31
源自:C++遠(yuǎn)征之封裝篇(上) 6-7
正在回答
#include <iostream>
#include <string>
using namespace std;
class Student {
string m_strName;
int m_iAge;
};
int main(){
Student * p=new student();
stu->m_strName="慕課網(wǎng)";
stu->m_iAge=2;
cout <<"student name is: "<<stu->m_strName<<"\t"<<"student age is:?"<<stu->m_iAge<<endl;
}
舉報(bào)
封裝--面向?qū)ο蟮幕?,本教程力求幫助小伙伴們即學(xué)即會(huì)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2019-09-04
#include <iostream>
#include <string>
using namespace std;
class Student {
string m_strName;
int m_iAge;
};
int main(){
Student * p=new student();
stu->m_strName="慕課網(wǎng)";
stu->m_iAge=2;
cout <<"student name is: "<<stu->m_strName<<"\t"<<"student age is:?"<<stu->m_iAge<<endl;
}