在C ++中访问父命名空间 [英] Accessing Parent Namespace in C++
本文介绍了在C ++中访问父命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个类似以下的场景:
I've got a scenario like the following:
class criterion
{
// stuff about criteria...
};
namespace hex {
class criterion : public criterion //does not compile
{ //This should inherit from the
//A hex specific criterion //criterion class in the global namespace
};
};
我的问题是-一个人如何从另一个命名空间的父级的namspace中的类继承?
My question is -- how does one inherit from a class in a namspace which is the parent of another namespace?
Billy3
推荐答案
以"::"开头
例如
class criterion : public ::criterion {};
这篇关于在C ++中访问父命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文