【发布时间】:2013-12-11 09:51:11
【问题描述】:
我有一个特殊的配置要构建,我不知道怎么写:
template <typename VarType>
class A
{
protected:
VarType m_myVar;
}
template <typename VarType>
class B : public A<VarType>
{
}
class C : public B<SpecialType>
{
void DoSomething()
{
m_myVar.PrivateFunction();
}
}
class SpecialType
{
private:
void PrivateFunction()
{
//Do something
}
}
我怎样才能使用关键字friend使它起作用??
感谢您的回答。
【问题讨论】:
-
在你的类声明any之后没有分号。祝你编译好运 ;-)
-
我为不得不维持这种可憎性的人感到抱歉:(
标签: c++ templates inheritance friend