简体   繁体   中英

Public struct inside a class and scopes

Let's say I have the following code in a header:

class A {
 public:
  struct B {...}
  ...
}

Shouldn't I be able to make this declaration in a source that includes the above header file:

 ...
B structb;
 ...

without having to declare the scope I'm using? (A::B structb)

Thanks a lot.

通过显示的代码,它意味着B是A内的结构,就像A的任何其他属性一样。因此,如果不使用范围解析,就无法声明或使用该变量。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM