How can I call a virtual Parent function using a lambda when its protected?
template<typename T>
class Parent
{
protected:
virtual int Show()
{
std::cout<<"Parent::Show Called\n";
}
};
class Child : Parent<Child>
{
protected:
virtual int Show() final override
{
std::cout<<"Child::Show Called\n";
//supposed to be in a thread in my original code.
auto call_parent = [&] {
//Parent<Child>::Create(); //call other parent functions..
Parent<Child>::Show();
};
call_parent();
}
};
The error I get is:
error: 'int Parent::Show() [with T = Child]' is protected within this context
Any ideas? I'm using GCC/G++ 4.8.1 on Windows.
Aucun commentaire:
Enregistrer un commentaire