single colon

This is a discussion on single colon within the C++ Programming forums, part of the General Programming Boards category; OK, a single colon follows an access specifier, such as public: or private: or protected:, right? Are there any other ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    104

    single colon

    OK, a single colon follows an access specifier, such as public:
    or private: or protected:, right? Are there any other situations in which a single colon : is used?

  2. #2
    Registered User
    Join Date
    Mar 2002
    Posts
    1,595
    intializer lists in constructors.

  3. #3
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    off the top of my head

    GOTO:something

  4. #4
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Inheritance access specifiers.

    Code:
    class a : public b
    {
    public:
       a( ) : x(0)
       {
          label:
          ++x;
          if(x < 4)
             goto label;
    
          (x > 3) ? x = 2 : x = 1;
       }
    private:
       int x;
    };
    Last edited by Zach L.; 07-17-2003 at 03:26 PM.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  5. #5
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Accessing a static member of a class: ios_base::hex.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Originally posted by XSquared
    Accessing a static member of a class: ios_base::hex.
    Single colon. Thats two.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  7. #7
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    I need to pay more attention .
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #8
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Conditionals:

    Condition ? TruePart : FalsePart
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #9
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Bah! No I gotta change my example.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  10. #10
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Code:
    cout<<"Enter a number:";
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  11. #11
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Most people tend to have only a single colon...
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  12. #12
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    And the most obvious:
    Code:
    switch( foo )
    {
        case 1:
            cout <<"Hey, you forgot about me!" << endl;
        break;
        default:
            cout << "Yeah!" << endl;
    }
    So don't make me get on your case about it!

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Single Entry Single Exit
    By robwhit in forum C Programming
    Replies: 5
    Last Post: 11-11-2007, 01:34 PM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  3. concatenating single chars to multi char arrays
    By TJJ in forum C Programming
    Replies: 7
    Last Post: 11-20-2003, 04:09 AM
  4. another question on using The colon :
    By kes103 in forum C++ Programming
    Replies: 8
    Last Post: 08-11-2003, 12:22 PM
  5. fancy strcpy
    By heat511 in forum C++ Programming
    Replies: 34
    Last Post: 05-01-2002, 05:29 PM

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