課程
/后端開發
/C++
/C++遠征之封裝篇(上)
老師調用拷貝函數用的是棧的方式,用堆的方式該怎么做?
2019-08-31
源自:C++遠征之封裝篇(上) 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="慕課網";
stu->m_iAge=2;
cout <<"student name is: "<<stu->m_strName<<"\t"<<"student age is:?"<<stu->m_iAge<<endl;
}
舉報
封裝--面向對象的基石,本教程力求幫助小伙伴們即學即會
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
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="慕課網";
stu->m_iAge=2;
cout <<"student name is: "<<stu->m_strName<<"\t"<<"student age is:?"<<stu->m_iAge<<endl;
}