The problem is that you have a class B and you want to encapsulate the
idea of "a particular instantiation of class B"
So one idea is to use another class to encapsulate the idea of
"a particular instantiation of class B"
So I use class A for that purpose.
I'll try to be a bit more concrete --
int f(double w, double x, double y, double z)
is an intricate mathematical function
B is a class for calculating f.
The problem is to illustrate this procedure for the numbers
1.1, 2.3, 4.5, 5.6 -- call the corresponding vector vec.
So I write
class B
{
public:
B(const std::vector<double>&);
protected:
int f(); // Computes f with respect to 4-dim vector in constructor
};
class A : public B
{
public:
A();
int F();
}
A::A() : B(vec)
{
}
int A::F()
{
return f();
}
int main()
{
A a;
std::cout << a.F() << " is the value of f when applied to the
illustrative parameters in vec ";
}