最新回答 / 慕仰0351134
如果是實例化對象數組就需要,實例化對象就不需要。Student *p=new Student();Student *q=new Student[20];
2020-09-15
最新回答 / weixin_慕桂英3298950
在Class類最后大括號外面加了;.也沒有用。?提示:[Error] expected unqualified-id before '{' token
2020-09-04
#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
string m_strName;
int m_iAge;
};
int main()
{
Student stu;
stu.m_strName = "慕課網";
stu.m_iAge = 2;
cout <<stu.m_strName << " " <<stu.m_iAge<< endl;
return 0;
}
#include <string>
using namespace std;
class Student
{
public:
string m_strName;
int m_iAge;
};
int main()
{
Student stu;
stu.m_strName = "慕課網";
stu.m_iAge = 2;
cout <<stu.m_strName << " " <<stu.m_iAge<< endl;
return 0;
}