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.
  • 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