Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. C++ trivia

C++ trivia

Scheduled Pinned Locked Moved The Lounge
c++asp-netcomtoolsquestion
25 Posts 14 Posters 0 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.
  • Greg UtasG Greg Utas

    Now why would I be hesitating to click on that link? :-D EDIT: Curiosity killed the cat. But it could have been worse!

    Robust Services Core | Software Techniques for Lemmings | Articles
    The fox knows many things, but the hedgehog knows one big thing.

    W Offline
    W Offline
    W Balboos GHB
    wrote on last edited by
    #12

    Greg Utas wrote:

    Now why would I be hesitating to click on that link?

    Answer I'd have given: Hesitant? Perhaps not enough roughage?

    Ravings en masse^

    "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

    "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

    1 Reply Last reply
    0
    • W W Balboos GHB

      Just to be on the safe side, be sure to consider this is the most distinct use of the colon.[^]

      Ravings en masse^

      "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

      "If you are searching for perfection in others, then you seek disappointment. If you seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #13

      I was going to say, "to write VB code because only ... " but he beat me too it ... :-D

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • H honey the codewitch

        i forgot labels. So now that's two things i forgot

        Real programmers use butterflies

        T Offline
        T Offline
        TheGreatAndPowerfulOz
        wrote on last edited by
        #14

        global scope operator, as in ::foo

        #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

        H 1 Reply Last reply
        0
        • T TheGreatAndPowerfulOz

          global scope operator, as in ::foo

          #SupportHeForShe Government can give you nothing but what it takes from somebody else. A government big enough to give you everything you want is big enough to take everything you've got, including your freedom.-Ezra Taft Benson You must accept 1 of 2 basic premises: Either we are alone in the universe or we are not alone. Either way, the implications are staggering!-Wernher von Braun

          H Offline
          H Offline
          honey the codewitch
          wrote on last edited by
          #15

          I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)

          Real programmers use butterflies

          H 1 Reply Last reply
          0
          • H honey the codewitch

            I presumed that was implied when i mentioned the namespace scope resolution operator (it's the same operator) :)

            Real programmers use butterflies

            H Offline
            H Offline
            Helena Munzarova
            wrote on last edited by
            #16

            In a ternary oparator

            sResult=(x<=0)?"0 or negative":"positive";

            H 1 Reply Last reply
            0
            • Greg UtasG Greg Utas

              List the distinct uses for a colon in C++. Motivated by currently writing a function that had better take all of them into account! :-D

              Robust Services Core | Software Techniques for Lemmings | Articles
              The fox knows many things, but the hedgehog knows one big thing.

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #17

              To keep my gastroenterologist in BMW's? Oh wait, wrong colon; my bad.

              Software Zen: delete this;

              1 Reply Last reply
              0
              • H honey the codewitch

                static member access, constructor initialization list. Base class list, namespace access, ternary operator, case signifier terminator. I feel like there are more but I'm sleepy. edit: other commenters pointed out labels and bitfields Don't forget to escape strings and chars!

                Real programmers use butterflies

                J Offline
                J Offline
                jason_s_coleman
                wrote on last edited by
                #18

                Range-based for loop?

                H 1 Reply Last reply
                0
                • H Helena Munzarova

                  In a ternary oparator

                  sResult=(x<=0)?"0 or negative":"positive";

                  H Offline
                  H Offline
                  honey the codewitch
                  wrote on last edited by
                  #19

                  i already mentioned that.

                  Real programmers use butterflies

                  1 Reply Last reply
                  0
                  • J jason_s_coleman

                    Range-based for loop?

                    H Offline
                    H Offline
                    honey the codewitch
                    wrote on last edited by
                    #20

                    is that a C++20 thing?

                    Real programmers use butterflies

                    J 1 Reply Last reply
                    0
                    • H honey the codewitch

                      is that a C++20 thing?

                      Real programmers use butterflies

                      J Offline
                      J Offline
                      jason_s_coleman
                      wrote on last edited by
                      #21

                      Nah, looks like C++11. e.g. for (auto it : vector) Range-based for loop (since C++11) - cppreference.com[^]

                      H 1 Reply Last reply
                      0
                      • J jason_s_coleman

                        Nah, looks like C++11. e.g. for (auto it : vector) Range-based for loop (since C++11) - cppreference.com[^]

                        H Offline
                        H Offline
                        honey the codewitch
                        wrote on last edited by
                        #22

                        huh. I've never actually used that..

                        Real programmers use butterflies

                        1 Reply Last reply
                        0
                        • H honey the codewitch

                          static member access, constructor initialization list. Base class list, namespace access, ternary operator, case signifier terminator. I feel like there are more but I'm sleepy. edit: other commenters pointed out labels and bitfields Don't forget to escape strings and chars!

                          Real programmers use butterflies

                          S Offline
                          S Offline
                          scedastic
                          wrote on last edited by
                          #23

                          Some of those are double colons. Are we counting them as well?

                          H 1 Reply Last reply
                          0
                          • S scedastic

                            Some of those are double colons. Are we counting them as well?

                            H Offline
                            H Offline
                            honey the codewitch
                            wrote on last edited by
                            #24

                            i did, because of the way the original question was worded.

                            Real programmers use butterflies

                            1 Reply Last reply
                            0
                            • Greg UtasG Greg Utas

                              List the distinct uses for a colon in C++. Motivated by currently writing a function that had better take all of them into account! :-D

                              Robust Services Core | Software Techniques for Lemmings | Articles
                              The fox knows many things, but the hedgehog knows one big thing.

                              P Offline
                              P Offline
                              progammer4you
                              wrote on last edited by
                              #25

                              Hi. I would like to help with the answer to your question. First, one colon is used to indicate the base class when inheriting from classes. Second, a single colon is used to specify the initialization list for the constructor. The two colons are the scoping operator.
                              Used to access the elements of the namespace. But in this matter, the editors of this site are more competent. Read more here: [url=https://sirinsoftware.com/services/iot-development/\]https://sirinsoftware.com/services/iot-development/\[/url\]

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups