Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!pilchuck!dataio!fnx!nazgul!bright From: bright@nazgul.UUCP (Walter Bright) Newsgroups: comp.lang.c++ Subject: Re: Implementing inheritance Keywords: C++ inheritance implementation description Message-ID: <291@nazgul.UUCP> Date: 28 Mar 91 19:34:04 GMT References: <1991Mar14.233914.14777@evax.arl.utexas.edu> <1885@news.tcs.com> <3398@litchi.bbn.com> <626@taumet.com> Reply-To: bright@nazgul.UUCP (Walter Bright) Distribution: all Organization: Zortech, Seattle Lines: 27 In article <626@taumet.com> steve@taumet.com (Stephen Clamage) writes: /Why would you need to know anything at /all about virtual tables to learn C++? Perhaps an example would help. I knew a guy in college once who was just learning to program. He was very meticulous, and carefully read all the pertinant manuals. Part of the program was used to write bytes to a file. He modularized the function that did this, all to proper practice. It turns out that the program ran incredibly slowly. He pulled his hair out trying to figure out why, then at wit's end showed the program to his roommate. His roommate found the problem immediately, it seems that in the function to write the output to a file, in the inner loop he opened the file for append, wrote a byte, and closed the file! Nothing anywhere in the manuals said that this was the wrong way to write a file... The point is, although theoretically you don't need to know how things are implemented in order to use them, in the real world it is necessary to understand what is going on. Not knowing how various C++ constructs are implemented, and what the various runtime tradeoffs are, will inevitably result in inefficient and large programs. I recommend that professionals occaisonally look at the assembler output of their compiler on their production code, the results can be very enlightening! :-) Disclaimer: I don't subscribe to the school of thought that program efficiency is irrelevant. (It's only irrelevant for one-shot or rarely used programs.)