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. General Programming
  3. Managed C++/CLI
  4. Operator :

Operator :

Scheduled Pinned Locked Moved Managed C++/CLI
6 Posts 3 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.
  • S Offline
    S Offline
    sheshidar
    wrote on last edited by
    #1

    Dear Friends..Can any one tell me about operator ":"

    G T 2 Replies Last reply
    0
    • S sheshidar

      Dear Friends..Can any one tell me about operator ":"

      G Offline
      G Offline
      George L Jackson
      wrote on last edited by
      #2

      You cam use ":" with "?". In the following example, the "?" can be interpreted as "then" and the ":" as else. int result = i > 10 ? 9 : 11; This is equivalent to: if (i > 10)   result = 9; else   result = 11; The ":" is also used with "public", "private" and "protected" to define security access within a class and inheritance. clas Derived : public Base { public: protected: private: }; You also use it to create a constructor initialize list in classes: class Foo { public:   Foo() : value(1) {} protected: private:   int value; }; George

      1 Reply Last reply
      0
      • S sheshidar

        Dear Friends..Can any one tell me about operator ":"

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #3

        the operator : doesn't exist


        Don't know where to start ?
        Refer the Forums Guidelines and ask a friend

        [VisualCalc 3.0][Flags Beginner's Guide]

        G 1 Reply Last reply
        0
        • T toxcct

          the operator : doesn't exist


          Don't know where to start ?
          Refer the Forums Guidelines and ask a friend

          [VisualCalc 3.0][Flags Beginner's Guide]

          G Offline
          G Offline
          George L Jackson
          wrote on last edited by
          #4

          ":" is not an operator by itself but in combination with "?" as a conditional operator "?:". -- modified at 20:54 Sunday 10th December, 2006 -- modified at 20:54 Sunday 10th December, 2006

          "We make a living by what we get, we make a life by what we give." --Winston Churchill

          T 1 Reply Last reply
          0
          • G George L Jackson

            ":" is not an operator by itself but in combination with "?" as a conditional operator "?:". -- modified at 20:54 Sunday 10th December, 2006 -- modified at 20:54 Sunday 10th December, 2006

            "We make a living by what we get, we make a life by what we give." --Winston Churchill

            T Offline
            T Offline
            toxcct
            wrote on last edited by
            #5

            that's why i said that operator : doesn't exist :suss: moreover, : appears in other situations, like classes inheriting in class definitions, construction list in class constructors definitions, etc... but still this is not an operator per se.


            Don't know where to start ?
            Refer the Forums Guidelines and ask a friend

            [VisualCalc 3.0][Flags Beginner's Guide]

            G 1 Reply Last reply
            0
            • T toxcct

              that's why i said that operator : doesn't exist :suss: moreover, : appears in other situations, like classes inheriting in class definitions, construction list in class constructors definitions, etc... but still this is not an operator per se.


              Don't know where to start ?
              Refer the Forums Guidelines and ask a friend

              [VisualCalc 3.0][Flags Beginner's Guide]

              G Offline
              G Offline
              George L Jackson
              wrote on last edited by
              #6

              I never said it was an operator. I just demonstrated its usage, and you explicited stated it was not an operator and restated my previous post. Also, I believe the ":" falls under the category of punctuation. Punctuation and operators are lexemes. Nevertheless, I appreciate your comments and hope we didn't confuse anyone.

              "We make a living by what we get, we make a life by what we give." --Winston Churchill

              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