Код: Выделить всё
#include
struct B;
struct A
{
B& b_;
//A(B& b):b_(b){}
};
struct B:A
{
int x = 5;
B():A(*this)
{
}
};
int main()
{
B b;
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79282539/why-i-cannot-initialize-a-reference-to-derived-class-without-construction-in-bas[/url]
Мобильная версия