Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #86855

Re: Virtual functions: To const, or not to const?

From Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Virtual functions: To const, or not to const?
Date 2022-10-10 17:58 +0200
Organization A noiseless patient Spider
Message-ID <ti1fee$remf$1@dont-email.me> (permalink)
References <thosit$6fp$1@gioia.aioe.org> <ths1rk$7039$2@dont-email.me> <ad5ab9e6-6982-413e-82f6-dfcbc1b425a3n@googlegroups.com> <20221008201946.00004e88@reddwarf.jmc.corp>

Show all headers | View raw


Am 08.10.2022 um 21:19 schrieb Mr Flibble:
> On Sat, 8 Oct 2022 11:03:35 -0700 (PDT)
> Michael S <already5chosen@yahoo.com> wrote:
> 
>> On Saturday, October 8, 2022 at 5:35:51 PM UTC+3, Bonita Montero
>> wrote:
>>> There is no general answer or it depends on what you expect from
>>> this interface. In individual cases, this question is then easy
>>> to answer and therefore I do not know why it has to be discussed.
>>
>> There is a general answer - don't use inheritance except as substitute
>> for interfaces, which typically means abstract classes with no data
>> members. All other forms of inheritance are known antipattern.
>> Use aggregation instead.
> 
> Bullshit. Whilst in general composition is to be preferred over
> inheritance there is nothing fundamentally wrong with deep inheritance
> hierarchies ...

There's nothing wrong in a sense that there's usually no alternative.
But nevertheless these hierarchies might be hard to design.

Back to comp.lang.c++ | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Virtual functions: To const, or not to const? Juha Nieminen <nospam@thanks.invalid> - 2022-10-07 09:47 +0000
  Re: Virtual functions: To const, or not to const? David Brown <david.brown@hesbynett.no> - 2022-10-07 12:50 +0200
    Re: Virtual functions: To const, or not to const? Juha Nieminen <nospam@thanks.invalid> - 2022-10-10 06:20 +0000
      Re: Virtual functions: To const, or not to const? Richard Damon <Richard@Damon-Family.org> - 2022-10-10 07:38 -0400
        Re: Virtual functions: To const, or not to const? Juha Nieminen <nospam@thanks.invalid> - 2022-10-10 12:08 +0000
          Re: Virtual functions: To const, or not to const? Richard Damon <Richard@Damon-Family.org> - 2022-10-10 20:47 -0400
      Re: Virtual functions: To const, or not to const? Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-10 15:13 +0300
        Re: Virtual functions: To const, or not to const? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-10-10 09:43 -0700
      Re: Virtual functions: To const, or not to const? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-10-10 09:26 -0700
  Re: Virtual functions: To const, or not to const? Paavo Helde <eesnimi@osa.pri.ee> - 2022-10-07 14:00 +0300
  Re: Virtual functions: To const, or not to const? Richard Damon <Richard@Damon-Family.org> - 2022-10-07 07:29 -0400
  Re: Virtual functions: To const, or not to const? Öö Tiib <ootiib@hot.ee> - 2022-10-07 05:55 -0700
  Re: Virtual functions: To const, or not to const? "Alf P. Steinbach" <alf.p.steinbach@gmail.com> - 2022-10-08 14:56 +0200
  Re: Virtual functions: To const, or not to const? Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-08 16:35 +0200
    Re: Virtual functions: To const, or not to const? Michael S <already5chosen@yahoo.com> - 2022-10-08 11:03 -0700
      Re: Virtual functions: To const, or not to const? Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-08 20:36 +0200
      Re: Virtual functions: To const, or not to const? Mr Flibble <flibble@reddwarf.jmc.corp> - 2022-10-08 20:19 +0100
        Re: Virtual functions: To const, or not to const? Bonita Montero <Bonita.Montero@gmail.com> - 2022-10-10 17:58 +0200
      Re: Virtual functions: To const, or not to const? Muttley@dastardlyhq.com - 2022-10-09 09:19 +0000
  Re: Virtual functions: To const, or not to const? Manfred <noname@add.invalid> - 2022-10-08 21:42 +0200

csiph-web