什么情况啊,怎么编译不了
#include <iostream>
#include <string>
using namespace std;
/**
* 定义类:Student
* 数据成员:m_strName
* 无参构造函数:Student()
* 有参构造函数:Student(string _name)
* 拷贝构造函数:Student(const Student& stu)
* 析构函数:~Student()
* 数据成员函数:setName(string _name)、getName()
*/
class Student
{
pubilc:
Student()
{
m_strName="";
}
Student(string _name)
{
m_strName=_name;
}
Student(const Student& stu){}
~Student(){}
void setName(string);
string getName();
private:
string m_strName;
};
void Student::setName(string _name)
{
m_strName=_name;
}
string Student::getName()
{
return m_strName;
}
int main(void)
{
// 通过new方式实例化对象*stu
Student *stu = new Student;
// 更改对象的数据成员为“慕课网”
stu->setName("慕课网");
// 打印对象的数据成员
cout<<stu->getName()<<endl;
delete stu;
stu=NULL;
return 0;
}
错误信息是
warning: no newline at end of file
error: invalid use of undefined type 'class Student'
error: forward declaration of 'class Student'
error: ISO C++ forbids declaration of 'pubilc' with no type
error: expected ';' before '{' token
error: expected `;' before 'Student'
In function 'int main()':
error: no matching function for call to 'Student::Student()'
note: candidates are: Student::Student(const Student&)
note: Student::Student(std::string)
error: 'void Student::setName(std::string)' is private
error: within this context
error: 'std::string Student::getName()' is private
error: within this context
error: 'Student::~Student()' is private
error: within this context