/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
class B{
public:
string name;
B(string n):name(n){
cout <<"B construct by name" <<endl;
};
B(){
cout <<"B construct by deafult" <<endl;
}
};
class A{
public:
B b;
A(){
this->b = B{"name"};
/*
I want to set this->b here,
not set by init list,
without B deafult construct(happen when A delcare).
*/
};
};
int main()
{
A a;
return 0;
}