220 37131 <CAOHCbiv+EQCcVnuY-2+gXfOLFq4xj5qVquZUx8VfTn7kv_85HA@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Tony V E <tvaneerd@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Use of "implement" when overriding a virtual
 method that does not have an implementation, yet.
Date: Wed, 28 Feb 2018 19:37:54 -0500
Lines: 340
Approved: news@gmane.org
Message-ID: <CAOHCbiv+EQCcVnuY-2+gXfOLFq4xj5qVquZUx8VfTn7kv_85HA@mail.gmail.com>
References: <8462ee66-9e9a-4579-8246-64861bf4a349@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="001a113ce000141b7205664f1232"
X-Trace: blaine.gmane.org 1519864556 30066 195.159.176.226 (1 Mar 2018 00:35:56 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Thu, 1 Mar 2018 00:35:56 +0000 (UTC)
To: Standard Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCUZ5QWKNQIOJFW52QCRUBCEK75CO@isocpp.org Thu Mar 01 01:35:52 2018
Return-path: <std-proposals+bncBCUZ5QWKNQIOJFW52QCRUBCEK75CO@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-oi0-f69.google.com ([209.85.218.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCUZ5QWKNQIOJFW52QCRUBCEK75CO@isocpp.org>)
	id 1erCCN-0007CU-FI
	for gclcip-std-proposals@m.gmane.org; Thu, 01 Mar 2018 01:35:51 +0100
Original-Received: by mail-oi0-f69.google.com with SMTP id w71sf2244751oia.20
        for <gclcip-std-proposals@m.gmane.org>; Wed, 28 Feb 2018 16:37:58 -0800 (PST)
ARC-Seal: i=2; a=rsa-sha256; t=1519864677; cv=pass;
        d=google.com; s=arc-20160816;
        b=dN1f82tikHbTm83MYFlt1mhkOWSkFT1Y/vg6AjD9xXYvGWT+z1oNEzV1RLRmsRZxfV
         +8Pk4BJqVlHx0+yDq4nb49h2CCaRJVLERKYvgIxYrgB3cyL/GbZObvmaXa2DUkyvleGp
         OyiRReCSRK35QNaQlC1lmWi8hDwSqOmDfiAn45hVAUXO8GpeoczuDt2EvmHXc5EGVfes
         VDdA12/hiOD3lT+SRzZctNO4ZVt9QBjDQ7HiY48aTRypsMLA1jXqFixpLWz6PzpVAXl7
         uiQz+RkLjcQRSxOsZgwS9DWzhF/agsBN49RZbqvFZSwRLV7CTKgSDznh0g8RRA3fB+t9
         suJQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:references:in-reply-to:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=DbNri1LbcaQNZ0F1jdJ6f0okojZL0qeXSzS5qMBMacA=;
        b=YSWCS+WSHVvKDvvCcXGi13L1bBBmzXufmATJ5ZAKzPTHaeXKhTSor455tnVUfgnzub
         2KvQPwox1rUkSCppGoFkJ1PYcaAvU/JLxnXMa8PEwkQhzDbmoouTxdl/GdCwSBlDqsuk
         r8s3VxvMck8LE/CnZM9HB/ZbWwJeG5KKZwjc3pE8Qj/GFpykEHvLsITPkVOclJ3/5mRl
         PLm0wyRRiSo24NkwC5yQwn3uf+eFtb4olVZSOKg1hYCt/pdP5w9pRDE40axrEcimkabi
         oh2K9y8y36ECvy2awfm5FOCLs8mBhCPBUlEwS+Be6gBOpZRbhF7axBaLxSakP3roZfWv
         Pvww==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=W/FprfDu;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tvaneerd@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=DbNri1LbcaQNZ0F1jdJ6f0okojZL0qeXSzS5qMBMacA=;
        b=g5bmYXndlqN6fQf9IBLDIh+o+oLx0cL1XPOO+sfg9W4L1WXwfA1zQOndE55eQHLeUn
         k/+Wl/85RpaB9PQxBoInMHLZToG+JhDp14HVo2jCL1/27QReDqkl8FLppYlXxBfYEfZt
         CSfNgREVhiEg3MqADVt6mewZh7Fep0jFibQ8B0M6VeUfn8xSUPgOGX9bIkCh4NTv6ipR
         xMDm/zb2TeSY0mf66ajQeFqjsSv5tYAHRrqVSTL+i0gtTJ422L2xOZkvO+eEcpqdRsOw
         NnGfi3Ucc3MBXZTRKwiWElNKHVqeFNbTPnYybqZX8RCswY3UXGDMZohg4Jw4yBVUch4z
         YEcA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=DbNri1LbcaQNZ0F1jdJ6f0okojZL0qeXSzS5qMBMacA=;
        b=HKYNAPeapWU8oO/fQ7/fvrGxpmQr39002Hc06iyNHEx7/mwK6QFAdduiMAl+iuU8Eq
         mD/d92EXxMBswM6b4ZRXKuJKHyDZgNSs0ddjmYG1d6uQ5ow6kUwnAUwwhjErP3nSSmTf
         lSckbIghkOb8gq/DiI7x9EVIBTWkUrSB6EiKwi6gtcG2rFb+hyP+1UBHrYkQ3t9yM9SG
         DeoXVUNgO2OCnxy8wwhsoyesf4CIMW+RCeu2gf6cBYNTa/yDW2JB9iunAMsiw5mphuiu
         I06TMVu1DDAwWoph0K6ve5ZkUsQ6VjK6/lqmKxoC/6KNxXoYZAJQnj1or0QL2Mmgvf5A
         r7MQ==
X-Gm-Message-State: APf1xPA8czui9uhIqx0Mev4XmZiLmt/PcWCjZWprjErtay0t2comiFRH
	iNxpbvHoos74n+QQJ2BQ6LJeQA==
X-Google-Smtp-Source: AG47ELsqvqejEbgUNsM3fAXsm4YswZqEJWmVoQzYw6Zi80mvnK7SEuHnh49yM5WtsznFAjsDwhRoeQ==
X-Received: by 10.202.104.73 with SMTP id d70mr10068435oic.25.1519864677203;
        Wed, 28 Feb 2018 16:37:57 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.202.229.206 with SMTP id c197ls704926oih.9.gmail; Wed, 28 Feb
 2018 16:37:55 -0800 (PST)
X-Received: by 10.202.191.214 with SMTP id p205mr2242oif.188.1519864675780;
        Wed, 28 Feb 2018 16:37:55 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1519864675; cv=none;
        d=google.com; s=arc-20160816;
        b=WZeKQLnS1IS1BZBhR0cv4Mq2ZXGfKIwY7VFcmDD7ytyvOs2LmYE2bsrp0z+zYod3Kw
         mTnuGK0TQ+9/kykR6nSEUUS7aP8qjoURCjkAsx9Qkry6WB7CfC0UJgKhGRbNjDAr6SMm
         MFWHQVwQH89ABFjyj7302WsqH0KxeZSTh8An/0w78fRgNV1M0sedCySixM33uyZC2Oyb
         34YY5/MHnEyReYL3Xo28+XyX8DHbhUGuZIReyPWlBxk155jsuWzb/uoSmfamztrz6pGK
         03qiuKX34zcf2wgglpRGRrRPldpveLCE+MBRHjfc84CJywhby0hkA/O3mxas7OVf51Ko
         Fvjg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:references:in-reply-to:mime-version
         :dkim-signature:arc-authentication-results;
        bh=wrJ1dcNAbeGLvhrqy4j2mANzjUnu/Xg8H6FnKDnZbzc=;
        b=BXVYIK8bKuXsrckUxeZD9WGsE6kFBZF9ax5UrZmkc956cMxG0qdDnsCcOiZJ7elxNe
         P6nZyq1QD37wO9aGLEIg3tVrN+XOlsoOR5IY9JTcuOftrUFHUfB33nwDYd6V0T46bbVh
         +d8b80El/qrHmPc2UhxbrateqB5IPopD6wGBHvPK56RGqs+6pkJ+3auw7QMb5LnevI+z
         H46sd5dp1zT49GIIPVTKfVt0AewwAdEND/RMdDSXIShV4hHtD/ftLcXwRYqYRXXL1SQI
         ia2rJRgPockIfeL0PhMKkm5C8sUyF0wa2ett0wUNMCNHCi9zkxuYZk5BfoP9Rh8h6xVd
         4yfw==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@gmail.com header.s=20161025 header.b=W/FprfDu;
       spf=pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=tvaneerd@gmail.com;
       dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com
Original-Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
        by mx.google.com with SMTPS id k73sor1119208oih.271.2018.02.28.16.37.55
        for <std-proposals@isocpp.org>
        (Google Transport Security);
        Wed, 28 Feb 2018 16:37:55 -0800 (PST)
Received-SPF: pass (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
X-Received: by 10.202.181.194 with SMTP id e185mr13082195oif.153.1519864675306;
 Wed, 28 Feb 2018 16:37:55 -0800 (PST)
Original-Received: by 10.157.112.129 with HTTP; Wed, 28 Feb 2018 16:37:54 -0800 (PST)
In-Reply-To: <8462ee66-9e9a-4579-8246-64861bf4a349@isocpp.org>
X-Original-Sender: tvaneerd@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com header.s=20161025 header.b=W/FprfDu;       spf=pass
 (google.com: domain of tvaneerd@gmail.com designates 209.85.220.41 as
 permitted sender) smtp.mailfrom=tvaneerd@gmail.com;       dmarc=pass (p=NONE
 sp=QUARANTINE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:37131
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/37131>

--001a113ce000141b7205664f1232
Content-Type: text/plain; charset="UTF-8"

On Wed, Feb 28, 2018 at 5:04 PM, <cristian64@gmail.com> wrote:

> Pretty often I find myself wanting to declare a method as *implement*, as
> opposed to using *override*.
>
> Here an example:
>
> #include <iostream>
>
> class A
> {
> public:
>     virtual ~A() {}
>     virtual void foo() { std::cout << "A::foo" << std::endl; }
>     virtual void bar() = 0;
> };
>
> class B : public A
> {
> public:
>     void foo() override { std::cout << "B::foo" << std::endl; }
>     void bar() implement { std::cout << "B::bar" << std::endl; }
> };
>
> It helps readability. The use of *override* implies that an implementation
> already exists and is going to be overridden, which is not the case for
> *A::bar*.
> *implement* would just fit in this case.
>
> If in the future an implementation for *A::bar* is provided, the compiler
> will let
> the developer know that an implementation is now being overridden, that is
> no
> longer "implementing it", but "overriding it", which may be bad. I, as a
> developer,
> want to be aware of that scenario. I would be able to decide whether the
> base
> implementation needs to be executed inside the derived class'
> implementation,
> and *when* it must be executed.
>


Never.  The base implementation should never be executed inside the derived
class' implementation.
Don't write hierarchies like that.  Don't make a convention when you can
structure the code such that the compiler can guarantee it.

The interface between base and derived should not be the same as the
interface between user and base.
See Herb's http://www.gotw.ca/publications/mill18.htm

If you need derived::foo() to call base::foo(), structure it so that
derived can't possibly get it wrong.
ie have the user call (non-virtual) base->foo(), which does its part, then
calls virtual doFoo() that derive implements.

Don't derive for the sake of implementation.
In general, inheritance is overused.  As Sean Parent said, "inheritance is
the base class of evil".



> For retro-compatibility, *override* could always be used where the use of
> *implement* is allowed.
>
> On the other hand, *implement* would become a reserved keyword of the C++
> programing language.
>
>
> Thoughts?
>
> --
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> To view this discussion on the web visit https://groups.google.com/a/
> isocpp.org/d/msgid/std-proposals/8462ee66-9e9a-4579-
> 8246-64861bf4a349%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/8462ee66-9e9a-4579-8246-64861bf4a349%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>



-- 
Be seeing you,
Tony

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbiv%2BEQCcVnuY-2%2BgXfOLFq4xj5qVquZUx8VfTn7kv_85HA%40mail.gmail.com.

--001a113ce000141b7205664f1232
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Wed, Feb 28, 2018 at 5:04 PM,  <span dir=3D"ltr">&lt;<a href=3D"mail=
to:cristian64@gmail.com" target=3D"_blank">cristian64@gmail.com</a>&gt;</sp=
an> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D=
"ltr">Pretty often I find myself wanting to declare a method as <b>implemen=
t</b>, as<br>opposed to using <b>override</b>.<br><br>Here an example:<br><=
br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187=
,187);border-style:solid;border-width:1px" class=3D"gmail-m_-91335435981407=
17626prettyprint"><font size=3D"2"><code class=3D"gmail-m_-9133543598140717=
626prettyprint"><div class=3D"gmail-m_-9133543598140717626subprettyprint"><=
span style=3D"color:rgb(136,0,0)" class=3D"gmail-m_-9133543598140717626styl=
ed-by-prettify">#include</span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-9133543598140717626styled-by-prettify"> </span><span style=3D"color:=
rgb(0,136,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">&lt;=
iostream&gt;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-91335=
43598140717626styled-by-prettify"><br><br></span><span style=3D"color:rgb(0=
,0,136)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">class</sp=
an><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626st=
yled-by-prettify"> A<br></span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_-9133543598140717626styled-by-prettify">{</span><span style=3D"=
color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">=
<br></span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-91335435981=
40717626styled-by-prettify">public</span><span style=3D"color:rgb(102,102,0=
)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">:</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=
=3D"gmail-m_-9133543598140717626styled-by-prettify">virtual</span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pret=
tify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-913354=
3598140717626styled-by-prettify">~</span><span style=3D"color:rgb(0,0,0)" c=
lass=3D"gmail-m_-9133543598140717626styled-by-prettify">A</span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-pr=
ettify">()</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543=
598140717626styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)=
" class=3D"gmail-m_-9133543598140717626styled-by-prettify">{}</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=
=3D"gmail-m_-9133543598140717626styled-by-prettify">virtual</span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pret=
tify"> </span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-91335435=
98140717626styled-by-prettify">void</span><span style=3D"color:rgb(0,0,0)" =
class=3D"gmail-m_-9133543598140717626styled-by-prettify"> foo</span><span s=
tyle=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-b=
y-prettify">()</span><code class=3D"gmail-m_-9133543598140717626prettyprint=
"><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626sty=
led-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmai=
l-m_-9133543598140717626styled-by-prettify">{</span><span style=3D"color:rg=
b(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> std</sp=
an><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-91335435981407176=
26styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gm=
ail-m_-9133543598140717626styled-by-prettify">cout </span><span style=3D"co=
lor:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify=
">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543=
598140717626styled-by-prettify"> </span><span style=3D"color:rgb(0,136,0)" =
class=3D"gmail-m_-9133543598140717626styled-by-prettify">&quot;A::foo&quot;=
</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-91335435981407176=
26styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D=
"gmail-m_-9133543598140717626styled-by-prettify">&lt;&lt;</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pretti=
fy"> std</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-91335=
43598140717626styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)"=
 class=3D"gmail-m_-9133543598140717626styled-by-prettify">endl</span><span =
style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-=
by-prettify">;</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-913=
3543598140717626styled-by-prettify"> </span><span style=3D"color:rgb(102,10=
2,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">}</span><spa=
n style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by=
-prettify"></span></code><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-9133543598140717626styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:rgb(0,0,136)" class=3D"gmail-m_-9133543598140717626styled-by-pre=
ttify">virtual</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-913=
3543598140717626styled-by-prettify"> </span><span style=3D"color:rgb(0,0,13=
6)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">void</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-b=
y-prettify"> bar</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-=
m_-9133543598140717626styled-by-prettify">()</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> =3D 0;</=
span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626=
styled-by-prettify"><br></span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_-9133543598140717626styled-by-prettify">};</span><span style=3D=
"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"=
><br>=C2=A0<br></span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-=
9133543598140717626styled-by-prettify">class</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> B </span=
><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626=
styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail=
-m_-9133543598140717626styled-by-prettify"> </span><span style=3D"color:rgb=
(0,0,136)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">public<=
/span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-913354359814071762=
6styled-by-prettify"> A<br></span><span style=3D"color:rgb(102,102,0)" clas=
s=3D"gmail-m_-9133543598140717626styled-by-prettify">{</span><span style=3D=
"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"=
><br></span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-9133543598=
140717626styled-by-prettify">public</span><span style=3D"color:rgb(102,102,=
0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">:</span><span =
style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-p=
rettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=
=3D"gmail-m_-9133543598140717626styled-by-prettify">void</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pretti=
fy"> foo</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-91335=
43598140717626styled-by-prettify">()</span><span style=3D"color:rgb(0,0,0)"=
 class=3D"gmail-m_-9133543598140717626styled-by-prettify"> </span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pret=
tify"><code class=3D"gmail-m_-9133543598140717626prettyprint"><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pretti=
fy"></span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-91335435981=
40717626styled-by-prettify">override</span><span style=3D"color:rgb(0,0,0)"=
 class=3D"gmail-m_-9133543598140717626styled-by-prettify"></span></code> </=
span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-913354359814071=
7626styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"g=
mail-m_-9133543598140717626styled-by-prettify"> std</span><span style=3D"co=
lor:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify=
">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140=
717626styled-by-prettify">cout </span><span style=3D"color:rgb(102,102,0)" =
class=3D"gmail-m_-9133543598140717626styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-b=
y-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_-91=
33543598140717626styled-by-prettify">&quot;B::foo&quot;</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pretti=
fy"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-91335435=
98140717626styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,=
0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> std</span><sp=
an style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styl=
ed-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-9133543598140717626styled-by-prettify">endl</span><span style=3D"color:rgb=
(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">;</sp=
an><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626st=
yled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gma=
il-m_-9133543598140717626styled-by-prettify">}</span><span style=3D"color:r=
gb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=3D"gmail-m_-9133=
543598140717626styled-by-prettify">void</span><span style=3D"color:rgb(0,0,=
0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> bar</span><sp=
an style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styl=
ed-by-prettify">()</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-9133543598140717626styled-by-prettify"> implement</span><span style=3D"col=
or:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> </=
span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-913354359814071=
7626styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"g=
mail-m_-9133543598140717626styled-by-prettify"> std</span><span style=3D"co=
lor:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify=
">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140=
717626styled-by-prettify">cout </span><span style=3D"color:rgb(102,102,0)" =
class=3D"gmail-m_-9133543598140717626styled-by-prettify">&lt;&lt;</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-b=
y-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_-91=
33543598140717626styled-by-prettify">&quot;B::bar&quot;</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-pretti=
fy"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-91335435=
98140717626styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,=
0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"> std</span><sp=
an style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717626styl=
ed-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
-9133543598140717626styled-by-prettify">endl</span><span style=3D"color:rgb=
(102,102,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify">;</sp=
an><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_-9133543598140717626st=
yled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"gma=
il-m_-9133543598140717626styled-by-prettify">}</span><span style=3D"color:r=
gb(0,0,0)" class=3D"gmail-m_-9133543598140717626styled-by-prettify"><br></s=
pan><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_-9133543598140717=
626styled-by-prettify">};</span></div></code></font></div><br>It helps read=
ability. The use of <b>override</b> implies that an implementation<br>alrea=
dy exists and is going to be overridden, which is not the c<span style=3D"f=
ont-family:arial,sans-serif">ase for <b>A::bar</b>.</span><br><b>implement<=
/b> would just fit in this case.<br><br>If in the future an implementation<=
span style=3D"font-family:arial,sans-serif"> for <b>A::bar</b> is provide</=
span>d, the compiler will let<br>the developer know that an implementation =
is now being overridden, that is no<br>longer &quot;implementing it&quot;, =
but &quot;overriding it&quot;, which may be bad. I, as a developer,<br>want=
 to be aware of that scenario. I would be able to decide whether the base<b=
r>implementation needs to be executed inside the derived class&#39; impleme=
ntation,<br>and <i>when</i> it must be executed.<br></div></blockquote><div=
><br><br></div><div>Never.=C2=A0 The base implementation should never be ex=
ecuted inside the derived class&#39; implementation.<br></div><div>Don&#39;=
t write hierarchies like that.=C2=A0 Don&#39;t make a convention when you c=
an structure the code such that the compiler can guarantee it.<br><br></div=
>The interface between base and derived should not be the same as the inter=
face between user and base.<br><div>
<div>See Herb&#39;s <a href=3D"http://www.gotw.ca/publications/mill18.htm">=
http://www.gotw.ca/publications/mill18.htm</a><br><br></div><div></div>

</div><div>If you need derived::foo() to call base::foo(), structure it so =
that derived can&#39;t possibly get it wrong.<br></div><div>ie have the use=
r call (non-virtual) base-&gt;foo(), which does its part, then calls virtua=
l doFoo() that derive implements.<br></div><div>=C2=A0<br></div><div>
Don&#39;t derive for the sake of implementation.<br>

In general, inheritance is overused.=C2=A0 As Sean Parent said, &quot;inher=
itance is the base class of evil&quot;.<br><br><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg=
b(204,204,204);padding-left:1ex"><div dir=3D"ltr"><br>For retro-compatibili=
ty, <b>override</b> could always be used where the use of<br><b>implement</=
b> is allowed.<br><br>On the other hand, <b>implement</b> would become a re=
served keyword of the C++<br>programing language.<br><br><br>Thoughts?<span=
 class=3D"gmail-HOEnZb"><font color=3D"#888888"><br></font></span></div><sp=
an class=3D"gmail-HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8462ee66-9e9a-4579-8246-64861bf4a349%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/8462=
ee66-9e9a-4579-<wbr>8246-64861bf4a349%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></div><br><br clear=3D"all"><br>-- <br><div clas=
s=3D"gmail_signature"><div dir=3D"ltr"><div>Be seeing you,<br></div>Tony<br=
></div></div>
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAOHCbiv%2BEQCcVnuY-2%2BgXfOLFq4xj5qV=
quZUx8VfTn7kv_85HA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOHCbiv%2BEQ=
CcVnuY-2%2BgXfOLFq4xj5qVquZUx8VfTn7kv_85HA%40mail.gmail.com</a>.<br />

--001a113ce000141b7205664f1232--

.
