最新回答 / 慕仰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;
}