Access Specifier before a class definition?

This is a discussion on Access Specifier before a class definition? within the C++ Programming forums, part of the General Programming Boards category; What does having an access specifier before a class definition mean? In this case, public: Code: public ref class ThreadX ...

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    7

    Access Specifier before a class definition?

    What does having an access specifier before a class definition mean?

    In this case, public:

    Code:
    public ref class ThreadX {
    
    
    // Class definition
    
    
    };
    I have never seen it used in this manner before. I am only familiar with seeing it with class members and with inheritance.

    Thanks for your help!

  2. #2
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    682
    It's a Microsoft's extension (it's not standard C++): Managed Extensions for C++ - Wikipedia, the free encyclopedia

    You should never use it, unless you really want to use C++/CLI.

    This "ref" is also an extension.
    I never put signature, but I decided to make an exception.

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    7
    Thanks, I think I was also looking at c# code but didn't realize it. I assumed it was C ++

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    That's not C#. "ref class" isn't C#. It could be C++/CLI or C++/CX. Both are Microsoft-invented extensions of C++ aimed at interoperating with Microsoft's technologies (.Net for C++/CLI, WinRT for C++/CX).
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. About inheritance and access specifier
    By student111 in forum C++ Programming
    Replies: 3
    Last Post: 06-29-2012, 07:52 AM
  2. access specifier of class
    By manish411 in forum C++ Programming
    Replies: 3
    Last Post: 10-10-2010, 02:42 AM
  3. storage class specifier
    By -EquinoX- in forum C Programming
    Replies: 5
    Last Post: 11-06-2008, 03:07 PM
  4. Replies: 5
    Last Post: 04-17-2008, 02:31 AM
  5. Order of access labels in class definition
    By Mario F. in forum C++ Programming
    Replies: 10
    Last Post: 06-16-2006, 07:13 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21