我有这个示例代码:
#include <iostream>
class A
{
public:
A()
{
std::cout << "Default constructor of A" << '\n';
}
A(int i)
{
std::cout << "Inside the constructor of A with one int argument" << '\n';
}
A(double i)
{
std::cout << "Inside the constructor of A with one double argument" << '\n';
}
};
class B : A
{
using A::A;
public:
B()
{
std::cout << "Default constructor of B" << '\n';
}
};
int main()
{
B b(12);
std::cout << …
Run Code Online (Sandbox Code Playgroud)