类定义后的类标签(?) [英] class label (?) after class definition
问题描述
亲爱的,
我是c +和这个论坛的新手,所以如果这个问题看起来很简单,我道歉。
我有时会看到这样的事情:
(1)静态类myfoo:public Foo {
(2)public:
(3)myfoo ():Foo(FooModel){}
。
。
。
(4)} class_my_foo;
具体来说,我不理解class_my_foo部分。它是为了什么?我想更多地了解这一点,但我甚至不知道该搜索什么。如果有人能指出我正确的方向我会很感激。
谢谢和问候。
< blockquote>它定义一个类,同时声明该类类型的变量。
static class A {...} a;
与
<相同pre lang =c ++> class A {...}; 静态 A a;
干杯
岸堤
Dear all,
I''m new to c++ and this forum so I apologize if this question seems very simple.
I sometimes see something like this:
(1) static class myfoo : public Foo {
(2) public:
(3) myfoo ():Foo ("FooModel") {}
.
.
.
(4) } class_my_foo;
Specifically, I don''t understand the "class_my_foo" part. What is it for? I''d love to read more about this but I don''t even know what to search for. If someone could kindly point me to the right direction I would appreciate it.
Thanks and regards.
It defines a class and at the same time declares a variable of that class type.
static class A {...} a;
is identical to
class A {...}; static A a;
Cheers
Andi
这篇关于类定义后的类标签(?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!