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. C / C++ / MFC
  4. C++ is 100% Object Oriented

C++ is 100% Object Oriented

Scheduled Pinned Locked Moved C / C++ / MFC
c++oopquestion
17 Posts 12 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.
  • A Anilkumar K V

    Is C++ is 100% OOP language? If yes, Justify If not, why

    _ Offline
    _ Offline
    _AnsHUMAN_
    wrote on last edited by
    #5

    anilFirst wrote:

    Is C++ is 100% OOP language?

    AFAIK,C++ is not 100% OOPS.

    anilFirst wrote:

    If not, why

    A language is OOPS if it encompasses all the four laws: 1) Encapsulation: Binding of data and member functions in one unit. 2) Polymorphism: One thing taking many forms.(Overloading etc). 3) Inheritence: Extending functionalities of classes. 4) Abstraction: Hiding of functionalities. But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

    Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

    M 1 Reply Last reply
    0
    • _ _AnsHUMAN_

      anilFirst wrote:

      Is C++ is 100% OOP language?

      AFAIK,C++ is not 100% OOPS.

      anilFirst wrote:

      If not, why

      A language is OOPS if it encompasses all the four laws: 1) Encapsulation: Binding of data and member functions in one unit. 2) Polymorphism: One thing taking many forms.(Overloading etc). 3) Inheritence: Extending functionalities of classes. 4) Abstraction: Hiding of functionalities. But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

      Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

      M Offline
      M Offline
      Mr Brainley
      wrote on last edited by
      #6

      _AnShUmAn_ wrote:

      But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

      This is not true. The explanation is written here : http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2[^] To answer the original question: No, C++ is not 100% OO, simply because it remains compatible with C. It's a sickness that does seem to be defeatable, that people insist on regarding C++ as an extension of C and therefor being totaly OK with producing crazy mix code that is bad in both worlds. I believe, that one can write 100% OO in C++, but i really can't proof that. Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

      _ B Z 3 Replies Last reply
      0
      • A Anilkumar K V

        Is C++ is 100% OOP language? If yes, Justify If not, why

        Z Offline
        Z Offline
        Zac Howland
        wrote on last edited by
        #7

        C++ is a blend of OO, functional, and generic programming. It is basically a catch-all language that you can do anything with.

        If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

        1 Reply Last reply
        0
        • M Mr Brainley

          _AnShUmAn_ wrote:

          But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

          This is not true. The explanation is written here : http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2[^] To answer the original question: No, C++ is not 100% OO, simply because it remains compatible with C. It's a sickness that does seem to be defeatable, that people insist on regarding C++ as an extension of C and therefor being totaly OK with producing crazy mix code that is bad in both worlds. I believe, that one can write 100% OO in C++, but i really can't proof that. Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #8

          Mr.Brainley wrote:

          The explanation is written here

          Thanks for that lovely article. Actually what's written in the books are the very basics that could go wrong (Just like this one ditched me) when you grow up in this world.

          Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_

          1 Reply Last reply
          0
          • A Anilkumar K V

            Is C++ is 100% OOP language? If yes, Justify If not, why

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #9

            anilFirst wrote:

            Is C++ is 100% OOP language?

            See here.


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            1 Reply Last reply
            0
            • M Mr Brainley

              _AnShUmAn_ wrote:

              But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

              This is not true. The explanation is written here : http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2[^] To answer the original question: No, C++ is not 100% OO, simply because it remains compatible with C. It's a sickness that does seem to be defeatable, that people insist on regarding C++ as an extension of C and therefor being totaly OK with producing crazy mix code that is bad in both worlds. I believe, that one can write 100% OO in C++, but i really can't proof that. Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

              B Offline
              B Offline
              benjymous
              wrote on last edited by
              #10

              Mr.Brainley wrote:

              Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

              main()

              -- Help me! I'm turning into a grapefruit! Buzzwords!

              M B 2 Replies Last reply
              0
              • M Mr Brainley

                _AnShUmAn_ wrote:

                But in C++ there is a friend function, using which you can not only access the variable's value you can also modify it that even from outside the class. Thus violating Encapsulation.

                This is not true. The explanation is written here : http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2[^] To answer the original question: No, C++ is not 100% OO, simply because it remains compatible with C. It's a sickness that does seem to be defeatable, that people insist on regarding C++ as an extension of C and therefor being totaly OK with producing crazy mix code that is bad in both worlds. I believe, that one can write 100% OO in C++, but i really can't proof that. Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

                Z Offline
                Z Offline
                Zac Howland
                wrote on last edited by
                #11

                Mr.Brainley wrote:

                I believe, that one can write 100% OO in C++, but i really can't proof that.

                You can write pure OO code in C++, but why would you want to? OOD/OOP is overkill (and actually doesn't fit well) for many things, which is why generic programming is also a strong feature in C++.

                If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac

                1 Reply Last reply
                0
                • B benjymous

                  Mr.Brainley wrote:

                  Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

                  main()

                  -- Help me! I'm turning into a grapefruit! Buzzwords!

                  M Offline
                  M Offline
                  Mr Brainley
                  wrote on last edited by
                  #12

                  See, that's my problem. Too often I don't see the obvious ...

                  1 Reply Last reply
                  0
                  • B benjymous

                    Mr.Brainley wrote:

                    Does anyone know of a certain problem that requires a non OO-workaround in C++ ?

                    main()

                    -- Help me! I'm turning into a grapefruit! Buzzwords!

                    B Offline
                    B Offline
                    BadKarma
                    wrote on last edited by
                    #13

                    why should this be a problem ??

                    codito ergo sum

                    B 1 Reply Last reply
                    0
                    • B BadKarma

                      why should this be a problem ??

                      codito ergo sum

                      B Offline
                      B Offline
                      benjymous
                      wrote on last edited by
                      #14

                      main() isn't the member of a class, it's a global function, which doesn't fit with the OO paradigm

                      -- Help me! I'm turning into a grapefruit! Buzzwords!

                      B 1 Reply Last reply
                      0
                      • B benjymous

                        main() isn't the member of a class, it's a global function, which doesn't fit with the OO paradigm

                        -- Help me! I'm turning into a grapefruit! Buzzwords!

                        B Offline
                        B Offline
                        BadKarma
                        wrote on last edited by
                        #15

                        you can easely change the entry point of a program through the compiler option /ENTRY:function. See help[^] How to do this:

                        class MyApplication
                        {
                          int __stdcall Run(int argc, _TCHAR* argv[]);
                        };
                        
                        int __stdcall MyApplication::Run(int argc, _TCHAR* argv[])
                        {
                          //  Place your code here
                          
                          return 0;
                        }
                        

                        Then change the entry point in the property settings of the project from blank (default) to MyApplication::Run. This way the program only excist out of one class embedding the entry point.

                        codito ergo sum

                        1 Reply Last reply
                        0
                        • A Anilkumar K V

                          Is C++ is 100% OOP language? If yes, Justify If not, why

                          D Offline
                          D Offline
                          Dan McCormick
                          wrote on last edited by
                          #16

                          The notion of 'object oriented' is a moving target. Here[^] is an interesting little article that discusses the different views held by some languages that support 'object oriented' programming. The article is a response to an essay by Paul Graham[^]. His essays make good reading and while you're at it, browse his site. I think most people will find it interesting -- whether you agree with his views or not. His writing can be thought provoking, or at very least provocative. Later, Dan

                          Be clear about the difference between your role as a programmer and as a tester. The tester in you must be suspicious, uncompromising, hostile, and compulsively obsessed with destroying, utterly destroying, the programmer's software. ------------ Boris Beizer

                          1 Reply Last reply
                          0
                          • A Anilkumar K V

                            Is C++ is 100% OOP language? If yes, Justify If not, why

                            S Offline
                            S Offline
                            Stephen Hewitt
                            wrote on last edited by
                            #17

                            C++ supports multiple programming padigrams; Object Oriented programming is just one of the supported padigrams. Others include generic programming. What do you mean by "100% Object Oriented"? It provides support for most OO concepts but does not force you to use them.

                            Steve

                            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