Does C++ provide a way to declare an object that has the type of a class within a class (e.g. foo_class::bar_class_in_class
in the example below) without having to use the scope resolution operator, as it does for a class within a namespace (e.g. foo_namespace::bar_class_in_namespace
in example below)?
namespace foo_namespace {
class bar_class_in_namespace {
};
}
class foo_class {
public:
class bar_class_in_class {
};
};
int main() {
using namespace foo_namespace;
bar_class_in_namespace bar_0;
// Can I access bar_class_in_class without having to use the
// the scope resolution operator?
foo_class::bar_class_in_class bar_1;
}
This question is the same as Can we alias a class name the way we do in namespaces?, with the minor difference that this question asks explicitly about a class within a class.