#include <iostream>
using namespace std;
class Test
{
public:
Test(){};
Test(int max)
{
this->m_max=max>0?max:100;
}
Test(int max, int min)
{
this->m_max=max>0?max:100;
this->m_min=min>0&&min<max?min:1;
}
Test(int max, int min,int mid)
{
this->m_max=max>0?max:100;
this->m_min=min>0&&min<max?min:1;
this->m_middle=mid<max&&mid>min?mid:50;
}
int m_max;
int m_min;
int m_middle;
};
class Test2
{
public:
Test2(){};
Test2(int max)
{
this->m_max=max>0?max:100;
}
Test2(int max, int min):Test2( max)
{
this->m_min=min>0&&min<max?min:1;
}
Test2(int max, int min,int mid):Test2(max,min)
{
this->m_middle=mid<max&&mid>min?mid:50;
}
int m_max;
int m_min;
int m_middle;
};
class Base
{
public:
Base(int i) :m_i(i) {}
Base(int i, double j) :m_i(i), m_j(j) {}
Base(int i, double j, string k) :m_i(i), m_j(j), m_k(k) {}
int m_i;
double m_j;
string m_k;
};
class Child:public Base{
using Base::Base;
};
void test()
{
Child c1(520, 13.14);
cout << "int: " << c1.m_i << ", double: " << c1.m_j << endl;
Child c2(520, 13.14, "i love you");
cout << "int: " << c2.m_i << ", double: " << c2.m_j << ", string: " << c2.m_k << endl;
}
int main() {
test();
return 0;
};