i made a new class inheriting QTcpsocket,with the following content :

mytcpsocket.h
Qt Code:
  1. #ifndef MYTCPSOCKET_H
  2. #define MYTCPSOCKET_H
  3.  
  4. #include <QTcpSocket>
  5. #include <QString>
  6. #include <qvariant.h>
  7.  
  8. class MyTcpSocket : public QTcpSocket
  9. {
  10. public:
  11. MyTcpSocket(QObject* parent = 0);
  12. void setClientUser(const QString &strClientUser);
  13. void setGroup(const int &iGroup);
  14. QString getClientUser();
  15. int getGroup();
  16. private:
  17. QString strClientUser;
  18. int iGroup;
  19. };
  20.  
  21. #endif // MYTCPSOCKET_H
To copy to clipboard, switch view to plain text mode 
mytcpsocket.cpp
Qt Code:
  1. #include "mytcpsocket.h"
  2.  
  3. MyTcpSocket::MyTcpSocket(QObject* parent) : QTcpSocket(parent)
  4. {
  5. //strClientUser = tr("Student");
  6. iGroup = 0;
  7. }
  8. void MyTcpSocket::setClientUser(const QString &strClientUser){
  9. this->strClientUser = strClientUser;
  10. }
  11. void MyTcpSocket::setGroup(const int &iGroup){
  12. this->iGroup = iGroup;
  13. }
  14. QString MyTcpSocket::getClientUser(){
  15. return strClientUser;
  16. }
  17. int MyTcpSocket::getGroup(){
  18. return iGroup;
  19. }
To copy to clipboard, switch view to plain text mode 

whenever i used the method of setClientUser or getClientUser
the program got exited with code -1073741819

but the methods of setGroup and getGroup run properly.

help me get to know and solve this problem.thank you so much