I have a templated class A
Assuming your really meant for A::test
to be publicly accessible, you could do something like this:
#include
template
struct ABase
{
ABase(int n) : test_( n > M )
{}
bool const test_;
};
template
struct A : ABase
{
A(int n) : ABase(n)
{}
};
template
A::A(int n)
: ABase<20>(n)
{ std::cerr << "One type" << std::endl; }
Kick the tires:
int main(int argc, char* argv[])
{
A a(19);
std::cout << "a:" << a.test_ << std::endl;
A b(31);
std::cout << "b:" << b.test_ << std::endl;
return 0;
}