Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT class default access modifier
Forum Updated to NodeBB v4.3 + New Features

QT class default access modifier

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 247 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jc_Opc
    wrote on last edited by
    #1

    Hi,

    This is a quick question, when a class is defined, what would be the default access modifier if there is none used after Q_OBJECT macro?

    class mainW : public QMAinWIndow
    {
    Q_OBJECT
    static const size_t var = 10;
    ...
    public:
    ...
    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      That's basic C++, everything that is above your "public:" is private.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        Jc_Opc
        wrote on last edited by
        #3

        Thanks.. I thought for QT was different... I am looking at the code and still there are many times the developer used "private" word many times inside the same class. I am not talking about private slots but some pointers and functions. Is it normal to find this kind of coding habit in QT world?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          That's unrelated to Qt.

          I have the habit of keeping things in order together by type.

          All public methods together, then the protected and then the private. And then again with the variables.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved