From -7204533323460356662
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8c9f1307b83ac2db
X-Google-Attributes: gidf78e5,public
From: Mark Wilden <Mark@mwilden.com>
Subject: Re: Q: virtual functions not overridable anymore?
Date: 1997/10/03
Message-ID: <34353BB4.121A@mWilden.com>#1/1
X-Deja-AN: 277651183
References: <01bcb109$1e790180$433574cf@worldnet.worldnet.att.net> <3404A0AE.6F7E@Eng.Sun.COM> <5uimip$l56@bgtnsc03.worldnet.att.net> <340D93AA.643A@Eng.Sun.COM> <01bcb951$ea80a440$909c389d@mtayler> <ocr4t7zlk2o.fsf@ml.com> <34166C9E.1882@pratique.fr> <341E7C8E.EA4@pratique.fr> <3420858D.12DB@mWilden.com> <34293558.73F@pratique.fr> <342C48EF.75AF@mWilden.com> <34352492.167EB0E7@pratique.fr>
X-Original-Date: Fri, 03 Oct 1997 11:38:44 -0700
Organization: The Mark Wilden Company
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANDVD2uEDnX0m9pzZAQEKywF/T91NFPmt8Joc0C1RnKETAlbnoYXahY5Q V8FSYar3aX/1FV9pbdel4iEhz2KXglpO =7a//
Newsgroups: comp.std.c++


Valentin Bonnard wrote:
> 
> I wrote:
>  > > virtual functions aren't a way to patch program to remove
>  > > bugs or to introduce debugging tests; they are a way to
>  > > write OO programs where the derived class define a function
>  > > the correct way.
>  > > Do you have any supporting references for that opinion?
> 
> It seems obvious enough to me.

OK, if you don't want to explain your opinion, that's fine.

> How do you debug a class without the source ?

In my example, you may just want to effectively put a breakpoint every
time a dialog opens.

> Anyway, you have no
> garanty
> that the overiding function will be called except if you know completly
> how the class works (that is, if you have the source).

If you have the header file, and the function to display the dialog is
virtual, you know at least that your function will be called wherever
the original one would be, if it's through a pointer or reference.

> But here, if the only
> argument is about debugging, I have to say that the cost of virtual
> trivial functions is very high.

This doesn't apply to my example, though.
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]



