What code fragments contain errors (compilation, execution, logical)?
(1) - error, because reference a can be initialized only in the initialization list.
(2) - an error because the reference a refers to the local variable b passed to the constructor as an argument. When exiting the constructor, the b variable will be destroyed and the value a becomes undefined.
(3) - no error. Here the reference a is equivalent to *this.
(4) - error. A is incomplete type while defining A a;

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Зарегистрируйся сейчас
или Подпишись на будущие тесты