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. Makes inheritance C++ slower than C?

Makes inheritance C++ slower than C?

Scheduled Pinned Locked Moved C / C++ / MFC
c++designooptutorialquestion
30 Posts 9 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.
  • T toxcct

    If inheritence was useless, why would people invent new languages such like Java or C# which are fully OO ? man, you certainly have to go through OOP and forget your way of thinking in C.

    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

    C Offline
    C Offline
    Cyon111
    wrote on last edited by
    #11

    Yes, I guess I stick to C pretty much. My slogan was: "Simple but effective!". With inheritance now I'm not sure whether I can maintain this slogan any more. Though, if it's true that inheritance can improve the design of the code, and I'm beginning to understand that it can, then for the sake of my slogan indeed I HAVE to include inheritance into my code.

    R T 2 Replies Last reply
    0
    • C Cyon111

      Yes, I guess I stick to C pretty much. My slogan was: "Simple but effective!". With inheritance now I'm not sure whether I can maintain this slogan any more. Though, if it's true that inheritance can improve the design of the code, and I'm beginning to understand that it can, then for the sake of my slogan indeed I HAVE to include inheritance into my code.

      R Offline
      R Offline
      Rajesh R Subramanian
      wrote on last edited by
      #12

      Cyon111 wrote:

      Yes, I guess I stick to C pretty much. My slogan was: "Simple but effective!".

      :omg: :wtf: Simple? You must try working on large code bases, one written on C and another on C++. You will then know which is more simpler.

      Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

      C 1 Reply Last reply
      0
      • C Cyon111

        Yes, I guess I stick to C pretty much. My slogan was: "Simple but effective!". With inheritance now I'm not sure whether I can maintain this slogan any more. Though, if it's true that inheritance can improve the design of the code, and I'm beginning to understand that it can, then for the sake of my slogan indeed I HAVE to include inheritance into my code.

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

        Cyon111 wrote:

        Simple but effective

        maybe. now with C++, your slogan will become "Effective at any cost !" :cool:

        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        R 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          Funny how you got downvoted on that. :)

          Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

          J Offline
          J Offline
          Jijo Raj
          wrote on last edited by
          #14

          Rajesh R Subramanian wrote:

          Funny how you got downvoted on that. Smile

          No idea buddy. Well, now a days I try to follow CPillani. He's so cool to down votes. He really never minds it. :D Regards, Jijo.

          _____________________________________________________ http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

          1 Reply Last reply
          0
          • R Rajesh R Subramanian

            Cyon111 wrote:

            Yes, I guess I stick to C pretty much. My slogan was: "Simple but effective!".

            :omg: :wtf: Simple? You must try working on large code bases, one written on C and another on C++. You will then know which is more simpler.

            Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

            C Offline
            C Offline
            Cyon111
            wrote on last edited by
            #15

            Well, there was a misconception on my side. I always thought that a simple language will resolve in a simple, short code. I might be wrong about that. :doh:

            T 1 Reply Last reply
            0
            • C Cyon111

              Well, there was a misconception on my side. I always thought that a simple language will resolve in a simple, short code. I might be wrong about that. :doh:

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

              well, let's imagine the smarter/most effective language in the world. how many lines of code de you think it would be for Windows to be written ?

              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              R C 2 Replies Last reply
              0
              • T toxcct

                Cyon111 wrote:

                Simple but effective

                maybe. now with C++, your slogan will become "Effective at any cost !" :cool:

                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                R Offline
                R Offline
                Roger Stoltz
                wrote on last edited by
                #17

                toxcct wrote:

                Effective at any cost !

                I'm sure the customer would like to hear that slogan, tox'... ;) How about exchanging "any" for "less"?

                "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                "High speed never compensates for wrong direction!" - unknown

                T 1 Reply Last reply
                0
                • R Roger Stoltz

                  toxcct wrote:

                  Effective at any cost !

                  I'm sure the customer would like to hear that slogan, tox'... ;) How about exchanging "any" for "less"?

                  "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                  "High speed never compensates for wrong direction!" - unknown

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

                  f*ck the customers off ! lol. we work for a better code and I don't like people telling me to code crap because a moron wants it earlier...

                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  R 1 Reply Last reply
                  0
                  • T toxcct

                    f*ck the customers off ! lol. we work for a better code and I don't like people telling me to code crap because a moron wants it earlier...

                    [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                    R Offline
                    R Offline
                    Roger Stoltz
                    wrote on last edited by
                    #19

                    toxcct wrote:

                    we work for a better code and I don't like people telling me to code crap because a moron wants it earlier...

                    I'm right beside you on the barricades, possibly with my back full of arrows 'cause that's how the pioneers are recognized. :-D

                    "It's supposed to be hard, otherwise anybody could do it!" - selfquote
                    "High speed never compensates for wrong direction!" - unknown

                    1 Reply Last reply
                    0
                    • T toxcct

                      well, let's imagine the smarter/most effective language in the world. how many lines of code de you think it would be for Windows to be written ?

                      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                      R Offline
                      R Offline
                      Rage
                      wrote on last edited by
                      #20

                      toxcct wrote:

                      how many lines of code de you think it would be for Windows to be written

                      an oneliner, or maybe two (kernel code): COperatingSystem co = new [OperatingSystem()]; co.Run(true); /* true to activate random bugs */

                      T 1 Reply Last reply
                      0
                      • R Rage

                        toxcct wrote:

                        how many lines of code de you think it would be for Windows to be written

                        an oneliner, or maybe two (kernel code): COperatingSystem co = new [OperatingSystem()]; co.Run(true); /* true to activate random bugs */

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

                        yup... and now, show out the COperatingSystem class :-)

                        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                        1 Reply Last reply
                        0
                        • T toxcct

                          well, let's imagine the smarter/most effective language in the world. how many lines of code de you think it would be for Windows to be written ?

                          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                          C Offline
                          C Offline
                          Cyon111
                          wrote on last edited by
                          #22

                          Uff, you are asking questions. I was wrong about inheritance and it was not the first time I was wrong about C++, so I'm floating in some sort of Lack-Of-Self-Confidence cloud right now. I would rather prefer to end this embarrassing post. :sigh: Though, on the bright side, it's better to embarrass myself here rather then later in my CV. So thank you guys for your time.:rose:

                          T 1 Reply Last reply
                          0
                          • C Cyon111

                            Uff, you are asking questions. I was wrong about inheritance and it was not the first time I was wrong about C++, so I'm floating in some sort of Lack-Of-Self-Confidence cloud right now. I would rather prefer to end this embarrassing post. :sigh: Though, on the bright side, it's better to embarrass myself here rather then later in my CV. So thank you guys for your time.:rose:

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

                            that was a rethorical question indeed... no need to answer it. it was just to show you the "wrongness" of your last assertion.

                            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                            1 Reply Last reply
                            0
                            • C Cyon111

                              I need some opinions, does make inheritance C++ slower than C and if yes, would it make sense to not use inheritance at all for that reason. I must admit that I'm not getting the idea behind inheritance and therefore would rather like to keep inheritance out of my code! I mean I know how to use inheritance in theory but I always felt it's something programmers don't really need. In short terms, I HATE INHERITANCE. So I'm looking for a good reason(excuse :laugh: ) to keep it out of my code. I'm working on a project right now and so far I'm not using inheritance and I'm happy with that. So in order to have something to write into my Technical Design Document of the Gunman project. I need a few good reasons why I kept inheritance out of my code. This Technical Design Document later will read my future employer, so it's part of my CV and I need something good to write. Everything, but no excuses! :laugh:

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

                              Cyon111 wrote:

                              In short terms, I HATE INHERITANCE.

                              So then why do you use it?

                              Cyon111 wrote:

                              So I'm looking for a good reason(excuse ) to keep it out of my code.

                              That's not possible.

                              Cyon111 wrote:

                              I'm working on a project right now and so far I'm not using inheritance...

                              I doubt that.

                              "Love people and use things, not love things and use people." - Unknown

                              "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                              C 1 Reply Last reply
                              0
                              • D David Crow

                                Cyon111 wrote:

                                In short terms, I HATE INHERITANCE.

                                So then why do you use it?

                                Cyon111 wrote:

                                So I'm looking for a good reason(excuse ) to keep it out of my code.

                                That's not possible.

                                Cyon111 wrote:

                                I'm working on a project right now and so far I'm not using inheritance...

                                I doubt that.

                                "Love people and use things, not love things and use people." - Unknown

                                "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                C Offline
                                C Offline
                                Cyon111
                                wrote on last edited by
                                #25

                                DavidCrow wrote:

                                So then why do you use it?

                                I have the feeling that I have to. I can't be the only one in a developer team who does not use inheritance. I guess it simply belongs to C++ and I have to accept it.

                                DavidCrow wrote:

                                That's not possible.

                                I was afraid of that!

                                DavidCrow wrote:

                                I doubt that.

                                Well, the Gunman project is smaller than you think and it's at the beginning. However, id Software programmed Quake 3 Arena without even using classes! Though, the newer game, Doom 3, has classes. I just had a look at it in order to learn how to use inheritance and well it's interesting. So far it seems that they only inherit classes and only 1 class at a time. Here is such a inheritance chain: idAFEntity_WithAttachedHead -> idAFEntity_Gibbable -> idAFEntity_Base -> idAnimatedEntity -> idEntity -> idClass

                                D 1 Reply Last reply
                                0
                                • C Cyon111

                                  DavidCrow wrote:

                                  So then why do you use it?

                                  I have the feeling that I have to. I can't be the only one in a developer team who does not use inheritance. I guess it simply belongs to C++ and I have to accept it.

                                  DavidCrow wrote:

                                  That's not possible.

                                  I was afraid of that!

                                  DavidCrow wrote:

                                  I doubt that.

                                  Well, the Gunman project is smaller than you think and it's at the beginning. However, id Software programmed Quake 3 Arena without even using classes! Though, the newer game, Doom 3, has classes. I just had a look at it in order to learn how to use inheritance and well it's interesting. So far it seems that they only inherit classes and only 1 class at a time. Here is such a inheritance chain: idAFEntity_WithAttachedHead -> idAFEntity_Gibbable -> idAFEntity_Base -> idAnimatedEntity -> idEntity -> idClass

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

                                  Cyon111 wrote:

                                  I guess it simply belongs to C++...

                                  Not necessarily. In C, a struct can be inherited.

                                  Cyon111 wrote:

                                  Well, the Gunman project is smaller than you think and it's at the beginning.

                                  Does it use objects like string, vector, list, or ostream?

                                  Cyon111 wrote:

                                  However, id Software programmed Quake 3 Arena without even using classes!

                                  But do they claim it to be written in C++ (or any OO language for that matter)?

                                  "Love people and use things, not love things and use people." - Unknown

                                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                  C 1 Reply Last reply
                                  0
                                  • D David Crow

                                    Cyon111 wrote:

                                    I guess it simply belongs to C++...

                                    Not necessarily. In C, a struct can be inherited.

                                    Cyon111 wrote:

                                    Well, the Gunman project is smaller than you think and it's at the beginning.

                                    Does it use objects like string, vector, list, or ostream?

                                    Cyon111 wrote:

                                    However, id Software programmed Quake 3 Arena without even using classes!

                                    But do they claim it to be written in C++ (or any OO language for that matter)?

                                    "Love people and use things, not love things and use people." - Unknown

                                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                    C Offline
                                    C Offline
                                    Cyon111
                                    wrote on last edited by
                                    #27

                                    DavidCrow wrote:

                                    Does it use objects like string, vector, list, or ostream?

                                    Nope, none of them. At least not yet. Why?

                                    DavidCrow wrote:

                                    But do they claim it to be written in C++?

                                    Nope, they don't claim it to be a C++ code.

                                    D 1 Reply Last reply
                                    0
                                    • C Cyon111

                                      DavidCrow wrote:

                                      Does it use objects like string, vector, list, or ostream?

                                      Nope, none of them. At least not yet. Why?

                                      DavidCrow wrote:

                                      But do they claim it to be written in C++?

                                      Nope, they don't claim it to be a C++ code.

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

                                      Cyon111 wrote:

                                      Why?

                                      Because those basic classes all use inheritance.

                                      Cyon111 wrote:

                                      Nope, they don't claim it to be a C++ code.

                                      Then why mention it?

                                      "Love people and use things, not love things and use people." - Unknown

                                      "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                      C 1 Reply Last reply
                                      0
                                      • D David Crow

                                        Cyon111 wrote:

                                        Why?

                                        Because those basic classes all use inheritance.

                                        Cyon111 wrote:

                                        Nope, they don't claim it to be a C++ code.

                                        Then why mention it?

                                        "Love people and use things, not love things and use people." - Unknown

                                        "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                        C Offline
                                        C Offline
                                        Cyon111
                                        wrote on last edited by
                                        #29

                                        DavidCrow wrote:

                                        Then why mention it?

                                        I said: "I'm working on a project right now and so far I'm not using inheritance...", you said: "I doubt that.", so, I concluded(wrongly I assume :doh: ) that you don't believe that it's possible to write the game without inheritance. So I gave you an example of a game that does not use inheritance because it does not even use classes at all.

                                        D 1 Reply Last reply
                                        0
                                        • C Cyon111

                                          DavidCrow wrote:

                                          Then why mention it?

                                          I said: "I'm working on a project right now and so far I'm not using inheritance...", you said: "I doubt that.", so, I concluded(wrongly I assume :doh: ) that you don't believe that it's possible to write the game without inheritance. So I gave you an example of a game that does not use inheritance because it does not even use classes at all.

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

                                          My point was, if you are using C++ but without any classes, then it's really just C.

                                          "Love people and use things, not love things and use people." - Unknown

                                          "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                          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