有一个更短的方法来转发在命名空间中声明一个类吗? [英] Is there a shorter way to forward declare a class in a namespace?
本文介绍了有一个更短的方法来转发在命名空间中声明一个类吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以通过这样做在命名空间中声明一个函数:
I can forward declare a function in a namespace by doing this:
void myNamespace::doThing();
相当于:
namespace myNamespace
{
void doThing();
}
要转发在命名空间中声明一个类:
To forward declare a class in a namespace:
namespace myNamespace
{
class myClass;
}
有更短的方法吗?我正在思考以下的线:
Is there a shorter way to do this? I was thinking something along the lines of:
class myNamespace::myClass;
推荐答案
No, however with a little reformatting
namespace myNamespace { class myClass; }
不比
class myNamespace::myClass;
这篇关于有一个更短的方法来转发在命名空间中声明一个类吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文