Topic: Use of "implement" when overriding a virtual


Author: Nicolas Lesser <blitzrakete@gmail.com>
Date: Wed, 28 Feb 2018 23:16:52 +0100
Raw View
--001a1140d0c8b5152305664d19fe
Content-Type: text/plain; charset="UTF-8"

Would you use implement for a pure virtual function with a definition?

I don't think it helps readability. IMO overriding nothing is still
overriding something. Adding yet another keyword to the language would
needlessly complicate it further and be yet another difference that
programmers will need to be aware of for no benefit at all except maybe a
possible clearer terminology, which is a non-issue in my opinion.

On Feb 28, 2018 11: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.

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>
..

--
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/CALmDwq1bFiV-V%2BZYHY8YfiJgBSN8v8Qk-74gOQMmRhj9ZdZzOQ%40mail.gmail.com.

--001a1140d0c8b5152305664d19fe
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Would you use implement for a pure virtual function with =
a definition?<div dir=3D"auto"><br></div><div dir=3D"auto">I don&#39;t thin=
k it helps readability. IMO overriding nothing is still overriding somethin=
g. Adding yet another keyword to the language would needlessly complicate i=
t further and be yet another difference that programmers will need to be aw=
are of for no benefit at all except maybe a possible clearer terminology, w=
hich is a non-issue in my opinion.</div></div><div class=3D"gmail_extra"><b=
r><div class=3D"gmail_quote">On Feb 28, 2018 11:04 PM,  &lt;<a href=3D"mail=
to:cristian64@gmail.com">cristian64@gmail.com</a>&gt; wrote:<br type=3D"att=
ribution"><blockquote class=3D"quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Pretty often I find mys=
elf wanting to declare a method as <b>implement</b>, as<br>opposed to using=
 <b>override</b>.<br><br>Here an example:<br><br><div style=3D"background-c=
olor:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bord=
er-width:1px" class=3D"m_5880001505346208548prettyprint"><font size=3D"2"><=
code class=3D"m_5880001505346208548prettyprint"><div class=3D"m_58800015053=
46208548subprettyprint"><span style=3D"color:rgb(136,0,0)" class=3D"m_58800=
01505346208548styled-by-prettify">#include</span><span style=3D"color:rgb(0=
,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> </span><span styl=
e=3D"color:rgb(0,136,0)" class=3D"m_5880001505346208548styled-by-prettify">=
&lt;iostream&gt;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800015=
05346208548styled-by-prettify"><br><br></span><span style=3D"color:rgb(0,0,=
136)" class=3D"m_5880001505346208548styled-by-prettify">class</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"=
> A<br></span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346=
208548styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D=
"m_5880001505346208548styled-by-prettify"><br></span><span style=3D"color:r=
gb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">public</span=
><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548styled-=
by-prettify">:</span><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505=
346208548styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">virtual</sp=
an><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by=
-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_58800015=
05346208548styled-by-prettify">~</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"m_5880001505346208548styled-by-prettify">A</span><span style=3D"color=
:rgb(102,102,0)" class=3D"m_5880001505346208548styled-by-prettify">()</span=
><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-p=
rettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505=
346208548styled-by-prettify">{}</span><span style=3D"color:rgb(0,0,0)" clas=
s=3D"m_5880001505346208548styled-by-prettify"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-pret=
tify">virtual</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800015053=
46208548styled-by-prettify"> </span><span style=3D"color:rgb(0,0,136)" clas=
s=3D"m_5880001505346208548styled-by-prettify">void</span><span style=3D"col=
or:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> foo</span=
><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548styled-=
by-prettify">()</span><code class=3D"m_5880001505346208548prettyprint"><spa=
n style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-pretti=
fy"> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_588000150534620=
8548styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"m=
_5880001505346208548styled-by-prettify"> std</span><span style=3D"color:rgb=
(102,102,0)" class=3D"m_5880001505346208548styled-by-prettify">::</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prett=
ify">cout </span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505=
346208548styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)=
" class=3D"m_5880001505346208548styled-by-prettify"> </span><span style=3D"=
color:rgb(0,136,0)" class=3D"m_5880001505346208548styled-by-prettify">&quot=
;A::foo&quot;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800015053=
46208548styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" cl=
ass=3D"m_5880001505346208548styled-by-prettify">&lt;&lt;</span><span style=
=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> st=
d</span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548=
styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58=
80001505346208548styled-by-prettify">endl</span><span style=3D"color:rgb(10=
2,102,0)" class=3D"m_5880001505346208548styled-by-prettify">;</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"=
> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_588000150534620854=
8styled-by-prettify">}</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58=
80001505346208548styled-by-prettify"></span></code><span style=3D"color:rgb=
(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:rgb(0,0,136)" class=3D"m_588000150534620854=
8styled-by-prettify">virtual</span><span style=3D"color:rgb(0,0,0)" class=
=3D"m_5880001505346208548styled-by-prettify"> </span><span style=3D"color:r=
gb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">void</span><=
span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-pre=
ttify"> bar</span><span style=3D"color:rgb(102,102,0)" class=3D"m_588000150=
5346208548styled-by-prettify">()</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"m_5880001505346208548styled-by-prettify"> =3D 0;</span><span style=3D=
"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"><br></=
span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548sty=
led-by-prettify">};</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800=
01505346208548styled-by-prettify"><br>=C2=A0<br></span><span style=3D"color=
:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">class</spa=
n><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-=
prettify"> B </span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001=
505346208548styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)" cl=
ass=3D"m_5880001505346208548styled-by-prettify"> </span><span style=3D"colo=
r:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">public</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-b=
y-prettify"> A<br></span><span style=3D"color:rgb(102,102,0)" class=3D"m_58=
80001505346208548styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0=
)" class=3D"m_5880001505346208548styled-by-prettify"><br></span><span style=
=3D"color:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">p=
ublic</span><span style=3D"color:rgb(102,102,0)" class=3D"m_588000150534620=
8548styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)" class=3D"m=
_5880001505346208548styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">=
void</span><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548s=
tyled-by-prettify"> foo</span><span style=3D"color:rgb(102,102,0)" class=3D=
"m_5880001505346208548styled-by-prettify">()</span><span style=3D"color:rgb=
(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> </span><span st=
yle=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify">=
<code class=3D"m_5880001505346208548prettyprint"><span style=3D"color:rgb(0=
,0,0)" class=3D"m_5880001505346208548styled-by-prettify"></span><span style=
=3D"color:rgb(0,0,136)" class=3D"m_5880001505346208548styled-by-prettify">o=
verride</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800015053462085=
48styled-by-prettify"></span></code> </span><span style=3D"color:rgb(102,10=
2,0)" class=3D"m_5880001505346208548styled-by-prettify">{</span><span style=
=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> st=
d</span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548=
styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58=
80001505346208548styled-by-prettify">cout </span><span style=3D"color:rgb(1=
02,102,0)" class=3D"m_5880001505346208548styled-by-prettify">&lt;&lt;</span=
><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-p=
rettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"m_588000150534=
6208548styled-by-prettify">&quot;B::foo&quot;</span><span style=3D"color:rg=
b(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> </span><span s=
tyle=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548styled-by-prett=
ify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58800015053=
46208548styled-by-prettify"> std</span><span style=3D"color:rgb(102,102,0)"=
 class=3D"m_5880001505346208548styled-by-prettify">::</span><span style=3D"=
color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify">endl</s=
pan><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548styl=
ed-by-prettify">;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001=
505346208548styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)=
" class=3D"m_5880001505346208548styled-by-prettify">}</span><span style=3D"=
color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=3D"m_58800015053=
46208548styled-by-prettify">void</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"m_5880001505346208548styled-by-prettify"> bar</span><span style=3D"co=
lor:rgb(102,102,0)" class=3D"m_5880001505346208548styled-by-prettify">()</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-b=
y-prettify"> implement</span><span style=3D"color:rgb(0,0,0)" class=3D"m_58=
80001505346208548styled-by-prettify"> </span><span style=3D"color:rgb(102,1=
02,0)" class=3D"m_5880001505346208548styled-by-prettify">{</span><span styl=
e=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> s=
td</span><span style=3D"color:rgb(102,102,0)" class=3D"m_588000150534620854=
8styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"m_5=
880001505346208548styled-by-prettify">cout </span><span style=3D"color:rgb(=
102,102,0)" class=3D"m_5880001505346208548styled-by-prettify">&lt;&lt;</spa=
n><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-=
prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"m_58800015053=
46208548styled-by-prettify">&quot;B::bar&quot;</span><span style=3D"color:r=
gb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"> </span><span =
style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548styled-by-pret=
tify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_5880001505=
346208548styled-by-prettify"> std</span><span style=3D"color:rgb(102,102,0)=
" class=3D"m_5880001505346208548styled-by-prettify">::</span><span style=3D=
"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify">endl</=
span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548sty=
led-by-prettify">;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_588000=
1505346208548styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0=
)" class=3D"m_5880001505346208548styled-by-prettify">}</span><span style=3D=
"color:rgb(0,0,0)" class=3D"m_5880001505346208548styled-by-prettify"><br></=
span><span style=3D"color:rgb(102,102,0)" class=3D"m_5880001505346208548sty=
led-by-prettify">};</span></div></code></font></div><br>It helps readabilit=
y. The use of <b>override</b> implies that an implementation<br>already exi=
sts and is going to be overridden, which is not the c<span style=3D"font-fa=
mily:arial,sans-serif">ase for <b>A::bar</b>.</span><br><b>implement</b> wo=
uld just fit in this case.<br><br>If in the future an implementation<span s=
tyle=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 &q=
uot;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<br>impl=
ementation needs to be executed inside the derived class&#39; implementatio=
n,<br>and <i>when</i> it must be executed.<br><br>For retro-compatibility, =
<b>override</b> could always be used where the use of<br><b>implement</b> i=
s allowed.<br><br>On the other hand, <b>implement</b> would become a reserv=
ed keyword of the C++<br>programing language.<br><br><br>Thoughts?<font col=
or=3D"#888888"><br></font></div><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></blockquote></div><br></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/CALmDwq1bFiV-V%2BZYHY8YfiJgBSN8v8Qk-7=
4gOQMmRhj9ZdZzOQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALmDwq1bFiV-V%=
2BZYHY8YfiJgBSN8v8Qk-74gOQMmRhj9ZdZzOQ%40mail.gmail.com</a>.<br />

--001a1140d0c8b5152305664d19fe--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 1 Mar 2018 00:23:55 +0200
Raw View
On 1 March 2018 at 00:04,  <cristian64@gmail.com> wrote:
> It helps readability. The use of override implies that an implementation
> already exists

No it doesn't.

> and is going to be overridden, which is not the case for
> A::bar.

It might be the case for A::bar as well.

> 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

The compiler doesn't know that, because the definition of A::bar can
be in a different
translation unit.

--
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/CAFk2RUbgifp_hYugv8gPqKf1pvAd9w48qG8owF2JeuB60-0e2Q%40mail.gmail.com.

.


Author: Richard Hodges <hodges.r@gmail.com>
Date: Wed, 28 Feb 2018 22:33:05 +0000
Raw View
--001a1147b726af6e7205664d53a2
Content-Type: text/plain; charset="UTF-8"

On 28 February 2018 at 22:04, <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.
>
> 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?
>

These are my thoughts:

#define implement override

But not in any code I'll end up maintaining, or any public header files
please.



>
> --
> 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>
> .
>

--
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/CALvx3hbSTNk-Tq3EH5KAOWS9NT-zee8n1urjgKj-V_tidz%2BKLw%40mail.gmail.com.

--001a1147b726af6e7205664d53a2
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 28 February 2018 at 22:04,  <span dir=3D"ltr">&lt;<a href=3D"mailto:=
cristian64@gmail.com" target=3D"_blank">cristian64@gmail.com</a>&gt;</span>=
 wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Pretty often I f=
ind myself wanting to declare a method as <b>implement</b>, as<br>opposed t=
o using <b>override</b>.<br><br>Here an example:<br><br><div style=3D"backg=
round-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:sol=
id;border-width:1px" class=3D"m_-1400620095787787110prettyprint"><font size=
=3D"2"><code class=3D"m_-1400620095787787110prettyprint"><div class=3D"m_-1=
400620095787787110subprettyprint"><span style=3D"color:rgb(136,0,0)" class=
=3D"m_-1400620095787787110styled-by-prettify">#include</span><span style=3D=
"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> </sp=
an><span style=3D"color:rgb(0,136,0)" class=3D"m_-1400620095787787110styled=
-by-prettify">&lt;iostream&gt;</span><span style=3D"color:rgb(0,0,0)" class=
=3D"m_-1400620095787787110styled-by-prettify"><br><br></span><span style=3D=
"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-prettify">cla=
ss</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110st=
yled-by-prettify"> A<br></span><span style=3D"color:rgb(102,102,0)" class=
=3D"m_-1400620095787787110styled-by-prettify">{</span><span style=3D"color:=
rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"><br></span><=
span style=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-=
prettify">public</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140=
0620095787787110styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)=
" class=3D"m_-1400620095787787110styled-by-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled=
-by-prettify">virtual</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-14=
00620095787787110styled-by-prettify"> </span><span style=3D"color:rgb(102,1=
02,0)" class=3D"m_-1400620095787787110styled-by-prettify">~</span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify">=
A</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062009578778711=
0styled-by-prettify">()</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-=
1400620095787787110styled-by-prettify"> </span><span style=3D"color:rgb(102=
,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">{}</span><span =
style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)" class=3D"m_-=
1400620095787787110styled-by-prettify">virtual</span><span style=3D"color:r=
gb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> </span><span=
 style=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-pret=
tify">void</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787=
787110styled-by-prettify"> foo</span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"m_-1400620095787787110styled-by-prettify">()</span><code class=3D"m=
_-1400620095787787110prettyprint"><span style=3D"color:rgb(0,0,0)" class=3D=
"m_-1400620095787787110styled-by-prettify"> </span><span style=3D"color:rgb=
(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">{</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-pret=
tify"> std</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062009=
5787787110styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" cla=
ss=3D"m_-1400620095787787110styled-by-prettify">cout </span><span style=3D"=
color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">&l=
t;&lt;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-14006200957877871=
10styled-by-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"m=
_-1400620095787787110styled-by-prettify">&quot;A::foo&quot;</span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify">=
 </span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062009578778711=
0styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" class=
=3D"m_-1400620095787787110styled-by-prettify"> std</span><span style=3D"col=
or:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">::</s=
pan><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-=
by-prettify">endl</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-14=
00620095787787110styled-by-prettify">;</span><span style=3D"color:rgb(0,0,0=
)" class=3D"m_-1400620095787787110styled-by-prettify"> </span><span style=
=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify=
">}</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110s=
tyled-by-prettify"></span></code><span style=3D"color:rgb(0,0,0)" class=3D"=
m_-1400620095787787110styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-prettif=
y">virtual</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787=
787110styled-by-prettify"> </span><span style=3D"color:rgb(0,0,136)" class=
=3D"m_-1400620095787787110styled-by-prettify">void</span><span style=3D"col=
or:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> bar</spa=
n><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110style=
d-by-prettify">()</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-140062=
0095787787110styled-by-prettify"> =3D 0;</span><span style=3D"color:rgb(0,0=
,0)" class=3D"m_-1400620095787787110styled-by-prettify"><br></span><span st=
yle=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prett=
ify">};</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787=
110styled-by-prettify"><br>=C2=A0<br></span><span style=3D"color:rgb(0,0,13=
6)" class=3D"m_-1400620095787787110styled-by-prettify">class</span><span st=
yle=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"=
> B </span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062009578778=
7110styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)" class=3D"m=
_-1400620095787787110styled-by-prettify"> </span><span style=3D"color:rgb(0=
,0,136)" class=3D"m_-1400620095787787110styled-by-prettify">public</span><s=
pan style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-pre=
ttify"> A<br></span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062=
0095787787110styled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" c=
lass=3D"m_-1400620095787787110styled-by-prettify"><br></span><span style=3D=
"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-prettify">pub=
lic</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787=
110styled-by-prettify">:</span><span style=3D"color:rgb(0,0,0)" class=3D"m_=
-1400620095787787110styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-prettify"=
>void</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-140062009578778711=
0styled-by-prettify"> foo</span><span style=3D"color:rgb(102,102,0)" class=
=3D"m_-1400620095787787110styled-by-prettify">()</span><span style=3D"color=
:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> </span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-pret=
tify"><code class=3D"m_-1400620095787787110prettyprint"><span style=3D"colo=
r:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"></span><sp=
an style=3D"color:rgb(0,0,136)" class=3D"m_-1400620095787787110styled-by-pr=
ettify">override</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620=
095787787110styled-by-prettify"></span></code> </span><span style=3D"color:=
rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">{</span>=
<span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-p=
rettify"> std</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062=
0095787787110styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" =
class=3D"m_-1400620095787787110styled-by-prettify">cout </span><span style=
=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify=
">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787=
787110styled-by-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=
=3D"m_-1400620095787787110styled-by-prettify">&quot;B::foo&quot;</span><spa=
n style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prett=
ify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787=
787110styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)" c=
lass=3D"m_-1400620095787787110styled-by-prettify"> std</span><span style=3D=
"color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">:=
:</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110sty=
led-by-prettify">endl</span><span style=3D"color:rgb(102,102,0)" class=3D"m=
_-1400620095787787110styled-by-prettify">;</span><span style=3D"color:rgb(0=
,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> </span><span sty=
le=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-pretti=
fy">}</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-140062009578778711=
0styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,=
136)" class=3D"m_-1400620095787787110styled-by-prettify">void</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify=
"> bar</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787=
787110styled-by-prettify">()</span><span style=3D"color:rgb(0,0,0)" class=
=3D"m_-1400620095787787110styled-by-prettify"> implement</span><span style=
=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify"> <=
/span><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095787787110s=
tyled-by-prettify">{</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-140=
0620095787787110styled-by-prettify"> std</span><span style=3D"color:rgb(102=
,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">::</span><span =
style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettif=
y">cout </span><span style=3D"color:rgb(102,102,0)" class=3D"m_-14006200957=
87787110styled-by-prettify">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)"=
 class=3D"m_-1400620095787787110styled-by-prettify"> </span><span style=3D"=
color:rgb(0,136,0)" class=3D"m_-1400620095787787110styled-by-prettify">&quo=
t;B::bar&quot;</span><span style=3D"color:rgb(0,0,0)" class=3D"m_-140062009=
5787787110styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" =
class=3D"m_-1400620095787787110styled-by-prettify">&lt;&lt;</span><span sty=
le=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-prettify">=
 std</span><span style=3D"color:rgb(102,102,0)" class=3D"m_-140062009578778=
7110styled-by-prettify">::</span><span style=3D"color:rgb(0,0,0)" class=3D"=
m_-1400620095787787110styled-by-prettify">endl</span><span style=3D"color:r=
gb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">;</span><=
span style=3D"color:rgb(0,0,0)" class=3D"m_-1400620095787787110styled-by-pr=
ettify"> </span><span style=3D"color:rgb(102,102,0)" class=3D"m_-1400620095=
787787110styled-by-prettify">}</span><span style=3D"color:rgb(0,0,0)" class=
=3D"m_-1400620095787787110styled-by-prettify"><br></span><span style=3D"col=
or:rgb(102,102,0)" class=3D"m_-1400620095787787110styled-by-prettify">};</s=
pan></div></code></font></div><br>It helps readability. The use of <b>overr=
ide</b> implies that an implementation<br>already exists and is going to be=
 overridden, which is not the c<span style=3D"font-family:arial,sans-serif"=
>ase for <b>A::bar</b>.</span><br><b>implement</b> would just fit in this c=
ase.<br><br>If in the future an implementation<span style=3D"font-family:ar=
ial,sans-serif"> for <b>A::bar</b> is provide</span>d, the compiler will le=
t<br>the developer know that an implementation is now being overridden, tha=
t 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 scenari=
o. I would be able to decide whether the base<br>implementation needs to be=
 executed inside the derived class&#39; implementation,<br>and <i>when</i> =
it must be executed.<br><br>For retro-compatibility, <b>override</b> could =
always be used where the use of<br><b>implement</b> is allowed.<br><br>On t=
he other hand, <b>implement</b> would become a reserved keyword of the C++<=
br>programing language.<br><br><br></div></blockquote><div><br></div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">Thoughts?</div>=
</blockquote><div><br></div><div>These are my thoughts:</div><div><br></div=
><div><span style=3D"font-family:monospace,monospace">#define implement ove=
rride</span><br></div><div><br></div><div>But not in any code I&#39;ll end =
up maintaining, or any public header files please.</div><div><br></div><div=
>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D=
"HOEnZb"><font color=3D"#888888"><br></font></span></div><span class=3D"HOE=
nZb"><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></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/CALvx3hbSTNk-Tq3EH5KAOWS9NT-zee8n1urj=
gKj-V_tidz%2BKLw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hbSTNk-Tq=
3EH5KAOWS9NT-zee8n1urjgKj-V_tidz%2BKLw%40mail.gmail.com</a>.<br />

--001a1147b726af6e7205664d53a2--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 28 Feb 2018 15:09:27 -0800 (PST)
Raw View
------=_Part_6742_1749788284.1519859367945
Content-Type: multipart/alternative;
 boundary="----=_Part_6743_123117070.1519859367946"

------=_Part_6743_123117070.1519859367946
Content-Type: text/plain; charset="UTF-8"

On Wednesday, February 28, 2018 at 5:04:42 PM UTC-5, crist...@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.
>

OK, the point of the `override` special identifier was to allow the
compiler to complain if there was no matching base class `virtual` function
that is being override. Without the keyword, if a base class virtual
function signature is changed without modifying all of the derived class
overrides of it, the compiler will still compile successfully despite being
broken logically. With the keyword, that becomes a hard error. The lack of
a hard error represents a real problem that real people encountered in real
code.

So, what "real problem" is being solved by using "implement" instead of
"override"? Is a function that uses "override" on a pure virtual function
genuinely *broken*? If not, then this is simply a matter of notation.

On the other hand, *implement* would become a reserved keyword of the C++
> programing language.
>

"`override`" isn't even a reserved keyword of C++. It's a special
identifier; it only takes on special meaning when used in exactly one place.

And I really wish C++ had more special identifiers.

--
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/b1ee2c48-dba3-4553-9743-62908c6d9adc%40isocpp.org.

------=_Part_6743_123117070.1519859367946
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, February 28, 2018 at 5:04:42 PM UTC-5, crist=
....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">Pretty often I find myself wanting to declare a method as <b>imple=
ment</b>, as<br>opposed to using <b>override</b>.<br><br>Here an example:<b=
r><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px"><font size=3D"2"><code><div><=
span style=3D"color:rgb(136,0,0)">#include</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&lt;iostream&gt;</span><s=
pan style=3D"color:rgb(0,0,0)"><br><br></span><span style=3D"color:rgb(0,0,=
136)">class</span><span style=3D"color:rgb(0,0,0)"> A<br></span><span style=
=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br></sp=
an><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"color:rgb=
(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:rgb(0,0,136)">virtual</span><span style=3D"color:r=
gb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">~</span><span style=
=3D"color:rgb(0,0,0)">A</span><span style=3D"color:rgb(102,102,0)">()</span=
><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,=
0)">{}</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:rgb(0,0,136)">virtual</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(0,0,136)">void</span><span style=3D"col=
or:rgb(0,0,0)"> foo</span><span style=3D"color:rgb(102,102,0)">()</span><co=
de><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,10=
2,0)">{</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"co=
lor:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">cout </span><=
span style=3D"color:rgb(102,102,0)">&lt;&lt;</span><span style=3D"color:rgb=
(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;A::foo&quot;</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102=
,0)">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=
=3D"color:rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">endl</s=
pan><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"=
color:rgb(0,0,0)"></span></code><span style=3D"color:rgb(0,0,0)"><br>=C2=A0=
 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">virtual</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,0,136)">void</span=
><span style=3D"color:rgb(0,0,0)"> bar</span><span style=3D"color:rgb(102,1=
02,0)">()</span><span style=3D"color:rgb(0,0,0)"> =3D 0;</span><span style=
=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};</s=
pan><span style=3D"color:rgb(0,0,0)"><br>=C2=A0<br></span><span style=3D"co=
lor:rgb(0,0,136)">class</span><span style=3D"color:rgb(0,0,0)"> B </span><s=
pan style=3D"color:rgb(102,102,0)">:</span><span style=3D"color:rgb(0,0,0)"=
> </span><span style=3D"color:rgb(0,0,136)">public</span><span style=3D"col=
or:rgb(0,0,0)"> A<br></span><span style=3D"color:rgb(102,102,0)">{</span><s=
pan style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(0,0,136)=
">public</span><span style=3D"color:rgb(102,102,0)">:</span><span style=3D"=
color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136=
)">void</span><span style=3D"color:rgb(0,0,0)"> foo</span><span style=3D"co=
lor:rgb(102,102,0)">()</span><span style=3D"color:rgb(0,0,0)"> </span><span=
 style=3D"color:rgb(0,0,0)"><code><span style=3D"color:rgb(0,0,0)"></span><=
span style=3D"color:rgb(0,0,136)">override</span><span style=3D"color:rgb(0=
,0,0)"></span></code> </span><span style=3D"color:rgb(102,102,0)">{</span><=
span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,102=
,0)">::</span><span style=3D"color:rgb(0,0,0)">cout </span><span style=3D"c=
olor:rgb(102,102,0)">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(0,136,0)">&quot;B::foo&quot;</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">&lt;&lt;=
</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb=
(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">endl</span><span sty=
le=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0=
,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">void</span=
><span style=3D"color:rgb(0,0,0)"> bar</span><span style=3D"color:rgb(102,1=
02,0)">()</span><span style=3D"color:rgb(0,0,0)"> implement</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</spa=
n><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:rgb(102,=
102,0)">::</span><span style=3D"color:rgb(0,0,0)">cout </span><span style=
=3D"color:rgb(102,102,0)">&lt;&lt;</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(0,136,0)">&quot;B::bar&quot;</span><span st=
yle=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">&lt;&=
lt;</span><span style=3D"color:rgb(0,0,0)"> std</span><span style=3D"color:=
rgb(102,102,0)">::</span><span style=3D"color:rgb(0,0,0)">endl</span><span =
style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"> </=
span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(=
0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};</span></div></co=
de></font></div><br>It helps readability. The use of <b>override</b> implie=
s that an implementation<br>already exists and is going to be overridden, w=
hich is not the c<span style=3D"font-family:arial,sans-serif">ase for <b>A:=
:bar</b>.</span><br><b>implement</b> would just fit in this case.<br></div>=
</blockquote><div><br>OK, the point of the `override` special identifier wa=
s to allow the compiler to complain if there was no matching base class `vi=
rtual` function that is being override. Without the keyword, if a base clas=
s virtual function signature is changed without modifying all of the derive=
d class overrides of it, the compiler will still compile successfully despi=
te being broken logically. With the keyword, that becomes a hard error. The=
 lack of a hard error represents a real problem that real people encountere=
d in real code.<br><br>So, what &quot;real problem&quot; is being solved by=
 using &quot;implement&quot; instead of &quot;override&quot;? Is a function=
 that uses &quot;override&quot; on a pure virtual function genuinely <i>bro=
ken</i>? If not, then this is simply a matter of notation.<br><br></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border=
-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On the other han=
d, <b>implement</b> would become a reserved keyword of the C++<br>programin=
g language.<br></div></blockquote><div><br>&quot;`override`&quot; isn&#39;t=
 even a reserved keyword of C++. It&#39;s a special identifier; it only tak=
es on special meaning when used in exactly one place.</div><br>And I really=
 wish C++ had more special identifiers.<br></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/b1ee2c48-dba3-4553-9743-62908c6d9adc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b1ee2c48-dba3-4553-9743-62908c6d9adc=
%40isocpp.org</a>.<br />

------=_Part_6743_123117070.1519859367946--

------=_Part_6742_1749788284.1519859367945--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Wed, 28 Feb 2018 19:37:54 -0500
Raw View
--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--

.