0
    class Base {
        Base (string, string);
    };

    class A : private Base {
        A (int, int);
    };

Is it allowed to use a class A's method in A's constructor as an argument of Base's constructor? I mean:

    A::A (int augend, int addend)
                  : Base(int_to_binary_string(6),int_to_binary_string(5)),
                    augend(augend), addend(addend)
    {

    }

int_to_binary_string() is A's method. I always thought that such a construction is not allowed, couse at first A_parent must be build, so A's methods do not exist yet.

  • Why is `int_to_binary_string` a member of `A` in the first place? – user657267 May 21 '16 at 12:15
  • yes you can do it only if the function is NOT virtual. – Yves May 21 '16 at 12:24
  • @user657267 A is a wrapper, I want to converse int to string which cointens binary number. – John Kokonesko May 21 '16 at 12:34
  • @Thomas thank you, it works – John Kokonesko May 21 '16 at 12:35
  • @JohnKokonesko A wrapper for what? Also it sounds like you're reimplementing [`std::bitset`](http://en.cppreference.com/w/cpp/utility/bitset). – user657267 May 21 '16 at 12:41
  • @JohnKokonesko anyway, you must make sure that the function that you call in ctor never use the data which hasnt been initialized. In your example, if `int_to_binary_string` doesn't use the data of A or of A_parent, then it's OK. Go to check the duplicated question. – Yves May 21 '16 at 12:48

0 Answers0