I have a class with QTcpSocket socket; as private member. Then, in class constructor I’m initialising with socket = new QTcpSocket();
When compiling, I’m getting error:
error: no match for ‘operator=’ in ‘((MyClass*)this)->MyClass::socket = (operator new(16u), (<statement>, ((QTcpSocket*)<anonymous>)))’
What’s wrong?
check declaration: if you wrote
QTcpSocket socket;you declare a object not a pointer. In this case you can t construct it withnew.You should declare
QTcpSocket* socket;