Временный объект и конструктор копирования [закрыто]C++

Программы на C++. Форум разработчиков
Anonymous
 Временный объект и конструктор копирования [закрыто]

Сообщение Anonymous »

У меня есть 3 связанных вопроса
Вопрос 1:

Код: Выделить всё

CLass_A ob1 = CLass_A();
//so **the temporary object** will call the empty constructor
// i expected that it will also call the Copy constructor to pass
// the temporary object into the ob1

//like this pattern
CLass_A ob0;
CLass_A ob1 =ob0;
here wil call the copy

Кроме того, это также не вызовет конструктор копирования, почему?

Код: Выделить всё

#include 
class A {
public:
A(){std::cout

Подробнее здесь: [url]https://stackoverflow.com/questions/79054667/temporary-object-and-copy-constructor[/url]

Вернуться в «C++»