You can write a function to do the calculations for you and return a Child_class
object, and use this to initialize your instance in the Owner_class
constructor initialization list:
Child_class make_child_object(string string_var, int test)
{
// do stuff, instantiate Child_class object, return it
}
Then
Owner_class(string s, int n) : foo(make_child_object(s, n) {}
If this method is unsuitable, then an alternative is to give Child_class
a default constructor, and assign it a value in the Owner_class
constructor body:
Owner_class(string s, int n)
{
// foo has been default constructed by the time you gethere.
// Do your stuff to calculate arguments of Child_class constructor.
....
// construct a Child_class instance and assign it to foo
foo = Child_class(a, b, c);
}