home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / cplus / 13682 < prev    next >
Encoding:
Text File  |  1992-09-15  |  1.5 KB  |  33 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!utcsri!torn!cunews!nrcnet0!bnrgate!bcrka451!bcrki65!sjm
  3. From: sjm@bcrki65.bnr.ca (Stuart MacMartin)
  4. Subject: Re: Virtual methods
  5. Message-ID: <1992Sep15.150236.13720@bcrka451.bnr.ca>
  6. Keywords: interrupt handler virtual methods
  7. Sender: 5E00 Corkstown News Server
  8. Organization: Bell-Northern Research Ltd., Ottawa, Canada
  9. References: <#7vnafk.feustel@netcom.com> <1992Sep14.145950.7661@us-es.sel.de> <1992Sep15.095940.13974@us-es.sel.de>
  10. Date: Tue, 15 Sep 1992 15:02:36 GMT
  11. Lines: 20
  12.  
  13. > feustel@netcom.com (David Feustel) writes:
  14. > |> Coplien's book "Advanced C++" makes the point that very little overhead
  15. > |> would be incurred in most programe even if all functions were declared
  16. > |> virtual and that some programs might even run faster than equivalent C
  17. > |> programs using switch constructs to achieve the same effects.
  18. > This reminds me of a question which I've been meaning to ask for some
  19. > time now. Ignoring performance issues, why would one not declare every
  20. > method in a class virtual? What circumstances might preclude its use?
  21.  
  22. Also, sometimes the extra 4 bytes for a pointer to a virtual table is
  23. not acceptable.  Some classes are instantiated hundreds of thousands of
  24. times, and having extra bytes is significant.
  25.  
  26. Stuart
  27. --
  28. : Stuart MacMartin                                    email: sjm@bnr.ca      :
  29. : Bell-Northern Research                              phone: (613) 763-5625  :
  30. : PO Box 3511, Stn C, Ottawa, K1Y-4H7, CANADA    Standard disclaimers apply. :
  31.