I have been working with QT and I noticed that they took OOP to another level by implementing some new features to classes such as private slots: public slots: signals: etc… What are they doing to declare such catagories of a class? Is it compiler specific or is it simply a sort of typedef? I am guessing it’s portable to major OS’s since QT will run on several systems. I ask out of curiosity and to create my own subclasses to help organize and create more OOP programs. For example
class Main
{
handles:
HANDLE hWin;
threads:
HANDLE hThread;
};
And then clean inheritance would be easy by simply doing
class Dialog : handles Main
{
};
To me, it looks like people are not answering your question, they’re answering something a little different. You seem to be talking about the “section tags” that just happen to be used for slots, and would like section tags for your own class sections like handles and threads. That is something that QT does by preprocessing the code before it gets sent to the compiler. It’s not something you could do yourself without adding another compilation stage.
That said, it really doesn’t have much of a use, except to tell the QT precompiler the sections to find it’s slots in. You can’t inherit them, as you appear to want to do. It just marks an area to generate introspective code on.
And you really wouldn’t want to do it like that anyway. If you have separate components that you’d like to inheret, separate them into separate classes, and then make those separate classes members of your larger class that controls their interaction. If you tried to split apart a class that had different sections, there would be no way for the compiler to ensure that they didn’t interact in some way that required invariants of the other pieces, because the compiler doesn’t put those kinds of boundaries up on using the different members.