how use constructor between class's?

see these 2 class's:
1
2
3
4
5
6
7
8
9
10
11
12
13
class test
{
public:
    test(string strText)
    {
        MessageBox(NULL, strText.c_str(), "hey", MB_OK);
    }
};

class test2("hello") : public test
{

}test2;

like you see the test class have a constructor.
on class test2, derived from test, how can i use the test constructor?
Like this:
1
2
3
4
5
class test2("hello") : public test
{
public:
  using test::test;
}t2("hello"); // Note: t2 is an object of type test2 
Or maybe you want this?
1
2
3
4
5
6
7
class test2 : public test
{
public:
  test2() : test("hello")
  {
  }
}
Last edited on
yes it's that i need. thank you so much for all.
so the base constructor is after the constructor name... thank you so much for all
Topic archived. No new replies allowed.