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