Lunatik
Lunatik

Reputation: 189

expected constructor, destructor, or type conversion before * ( line 45)

subj on line 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;
}

Upvotes: 2

Views: 239

Answers (1)

aschepler
aschepler

Reputation: 72431

Students is really a "nested type", and the compiler can't figure out what it refers to since it hasn't seen the Server:: context yet. You need:

Server::Students* Server::getStudents() const

Upvotes: 6

Related Questions