Colon in C++ private member declarations?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UmljayBQaW5ncnk=?=

    Colon in C++ private member declarations?

    I have been looking over the DSO Framer example
    (http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
    syntax that I have never come across in C++. In the header file, you see
    some unsigned int private member variables with a colon and a value. It
    looks like some kind of member initialization, but I did not know you could
    do it that way in C++. Note that it is NOT a member initialization list as a
    part of a constructor; I know what that is. Here is what it looks like:

    class CDsoFramerClass Factory : public IClassFactory
    {
    ....
    private:
    ....
    unsigned int m_fModeFlagVali d:1; // has mode changed since
    last check?
    unsigned int m_fBorderStyle: 2; // the border style
    ....
    };

    Any ideas?
  • Jeroen Mostert

    #2
    Re: Colon in C++ private member declarations?

    Rick Pingry wrote:
    I have been looking over the DSO Framer example
    (http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
    syntax that I have never come across in C++. In the header file, you see
    some unsigned int private member variables with a colon and a value. It
    looks like some kind of member initialization, but I did not know you could
    do it that way in C++. Note that it is NOT a member initialization list as a
    part of a constructor; I know what that is. Here is what it looks like:
    >
    class CDsoFramerClass Factory : public IClassFactory
    {
    ...
    private:
    ...
    unsigned int m_fModeFlagVali d:1; // has mode changed since
    last check?
    unsigned int m_fBorderStyle: 2; // the border style
    ...
    };
    >
    Any ideas?
    These are bitfields, and they're as old as C.




    --
    J.

    Comment

    • Pavel A.

      #3
      Re: Colon in C++ private member declarations?

      This is a bit field. a plain pedestrian C thing, it has no class <g>

      --PA


      "Rick Pingry" <Rick Pingry@discussi ons.microsoft.c omwrote in message
      news:8A421E1F-CEFF-47EA-AC41-FD49352AB8DB@mi crosoft.com...
      I have been looking over the DSO Framer example
      (http://support.microsoft.com/kb/311765). As I reviewed the code, I saw
      syntax that I have never come across in C++. In the header file, you see
      some unsigned int private member variables with a colon and a value. It
      looks like some kind of member initialization, but I did not know you
      could
      do it that way in C++. Note that it is NOT a member initialization list as
      a
      part of a constructor; I know what that is. Here is what it looks like:
      >
      class CDsoFramerClass Factory : public IClassFactory
      {
      ...
      private:
      ...
      unsigned int m_fModeFlagVali d:1; // has mode changed since
      last check?
      unsigned int m_fBorderStyle: 2; // the border style
      ...
      };
      >
      Any ideas?

      Comment

      • =?Utf-8?B?UmljayBQaW5ncnk=?=

        #4
        Re: Colon in C++ private member declarations?

        Wow, thanks for the fast response, with a link even!

        Comment

        Working...