Answer the question
In order to leave comments, you need to log in
Does an error occur when creating an instance of a class in a method and returning?
I create an object in a method and return a pointer to it, like this, I hope that I'm doing something wrong.
Socket* Socket::accept() {
/* ГДЕ то тут инициализирую this->address = str_addr; // 127.0.0.1
*/
return new Socket(client_sock_id);
}
// ВЫЗЫВАЮ ЗДЕСЬ
Socket *c = s.accept();
// с->getAddress()// выходят русские буквы МММММММММММММММММММММММММ-штук под 100 или больше
Answer the question
In order to leave comments, you need to log in
Socket* Socket::accept() { /* ГДЕ то тут инициализирую this->address = str_addr; // 127.0.0.1 */ return new Socket(client_sock_id); } // ВЫЗЫВАЮ ЗДЕСЬ Socket *c = s.accept(); // с->getAddress()// выходят русские буквы МММ....-штук под 100 или больше
I hope I'm doing something wrong.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question