第45行的主题
//Server.h
class Server : public QTcpServer
{
Q_OBJECT
public:
typedef QHash<int, Student*> Students;
...
Students* getStudents () const;
...
private:
Students _students;
};
//Server.cpp
void Server::setPort( quint16 port )
{
_port = port;
}
quint16 Server::getPort() const
{
return _port;
}
Students* Server::getStudents() const // line 45
{
return _students;
}
答案 0 :(得分:6)
Students
实际上是一个“嵌套类型”,编译器无法弄清楚它所引用的内容,因为它还没有看到Server::
上下文。你需要:
Server::Students* Server::getStudents() const