Question: I was doing Qt gui programming, in signals and slot section, I have the following syntax:

```
class Myclass
{
   public slot:

   signal:

}

```

Is this allowed to have a labelled region in class because normally I have seen this:

```
class Myclass
{
    public:
    //declarations
}

```

Can access modifiers have label also or it is a specific syntax in Qt?

Please clarify. Any help is appreciated. Thanks in advance.

Answer: 
These labels are Qt extensions to C++ (<http://woboq.com/blog/how-qt-signals-slots-work.html>). The MOC compiler parses the files and generates relevant glue logic. Details are in the link.
Qt's headers define these preprocessor macros, so that when compiling, `slot` expands to the empty string, and `signal` expands to `protected` (in Qt 4) or `public` (in Qt 5). So as far as the C++ compiler is concerned, it sees something like:

```
class Myclass
{
   public :  /* was public slots */

   public:   /* was signals */

}

```

for your example above.

When the Meta-Object Compiler `moc` is run on the same declaration, it interprets the (un-substituted) Qt keywords, and uses them to compose meta-objects.