Why must I put a semicolon at the end of class declaration in C++?

后端 未结 6 635
旧巷少年郎
旧巷少年郎 2020-12-01 09:22

In a C++ class declaration:

class Thing
{
    ...
};

why must I include the semicolon?

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 09:33

    because you can optionally declare objects

    class Thing
    {
        ...
    }instanceOfThing;
    

    for historical reasons

提交回复
热议问题