Topic: Override block to mark all methods within that block override


Author: husain jiruwala <husain.255@gmail.com>
Date: Wed, 21 Jun 2017 03:42:29 -0700 (PDT)
Raw View
------=_Part_4799_1697975553.1498041749094
Content-Type: multipart/alternative;
 boundary="----=_Part_4800_43728629.1498041749095"

------=_Part_4800_43728629.1498041749095
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi=20
down vote


favorite=20
<https://stackoverflow.com/questions/44672846/override-block-instead-of-ove=
rride-keyword-on-all-methods?noredirect=3D1>

Proposing a  way I can  take advantage of override keyword without writing=
=20
override after each method.

I have couple of points to desire such a thing

=C2=B7         Its error prone to mark each method override when you are de=
aling=20
with legacy code and introducing the override keyword in the existing class

=C2=B7         You have too many override methods

=C2=B7         Override methods maybe scattered around in class declaration=
=20
mangled with bunch of other methods its good to group them as a good=20
practice.

I am looking for something like override block using scope, when any method=
=20
is part of this block its same as writing override after the method=20
signature.

e.g.

class derived: public base

{

   public:

=20

      *override* {

              int blah();

               void blahBlah();

                .. and so on

      }

};

=20

The above code is supposed to be same as writing override after each method=
..


Thanks

Husen Jiruwala

--=20
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 e=
mail 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/9ec15216-718e-4733-8ae0-9e23fd223fd0%40isocpp.or=
g.

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

<div dir=3D"ltr">Hi=C2=A0<br><div><table style=3D"font-variant-numeric: inh=
erit; font-stretch: inherit; line-height: inherit; font-family: Arial, &quo=
t;Helvetica Neue&quot;, Helvetica, sans-serif; vertical-align: baseline; bo=
rder-collapse: collapse; color: rgb(36, 39, 41);"><tbody style=3D"font-styl=
e: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inhe=
rit; font-size: inherit; line-height: inherit; font-family: inherit; vertic=
al-align: baseline;"><tr style=3D"font-style: inherit; font-variant: inheri=
t; font-weight: inherit; font-stretch: inherit; font-size: inherit; line-he=
ight: inherit; font-family: inherit; vertical-align: baseline;"><td class=
=3D"votecell" style=3D"padding-right: 15px; font-style: inherit; font-varia=
nt: inherit; font-weight: inherit; font-stretch: inherit; font-size: inheri=
t; line-height: inherit; font-family: inherit; vertical-align: top;"><div c=
lass=3D"vote" style=3D"font-style: inherit; font-variant: inherit; font-wei=
ght: inherit; font-stretch: inherit; font-size: inherit; line-height: inher=
it; font-family: inherit; vertical-align: baseline; text-align: center; min=
-width: 46px;"><a class=3D"vote-down-off" title=3D"This question does not s=
how any research effort; it is unclear or not useful" style=3D"margin-right=
: auto; margin-bottom: 10px; margin-left: auto; font-style: inherit; font-v=
ariant: inherit; font-weight: inherit; font-stretch: inherit; font-size: 1p=
x; line-height: inherit; font-family: inherit; vertical-align: baseline; co=
lor: rgb(0, 119, 204); cursor: pointer; background-image: url(&quot;img/spr=
ites.svg?v=3D1b3cdae197be&quot;), none; background-size: initial; backgroun=
d-repeat: no-repeat; overflow: hidden; display: block; text-indent: -9999em=
; width: 40px; height: 30px; background-position: 0px -220px;">down vote</a=
></div></td><td class=3D"postcell" style=3D"font-style: inherit; font-varia=
nt: inherit; font-weight: inherit; font-stretch: inherit; font-size: inheri=
t; line-height: inherit; font-family: inherit; vertical-align: top;"></td><=
/tr></tbody></table><table class=3D"MsoNormalTable" border=3D"0" cellspacin=
g=3D"0" cellpadding=3D"0" style=3D"background-image: initial; background-po=
sition: initial; background-size: initial; background-repeat: initial; back=
ground-attachment: initial; background-origin: initial; background-clip: in=
itial; border-collapse: collapse;">
 <tbody><tr>
  <td valign=3D"top" style=3D"padding:0in 11.25pt 0in 0in">
  <p class=3D"MsoNormal" align=3D"center" style=3D"text-align:center;vertic=
al-align:baseline"><span style=3D"font-size:10.0pt;font-family:inherit;mso-=
bidi-font-family:Arial;
  color:#242729"><a href=3D"https://stackoverflow.com/questions/44672846/ov=
erride-block-instead-of-override-keyword-on-all-methods?noredirect=3D1" tit=
le=3D"Click to mark as favorite question (click again to undo)"><span style=
=3D"font-size: 1pt; color: rgb(0, 119, 204); border-width: 1pt; border-styl=
e: none; border-color: windowtext; padding: 0in;"><br>
  favorite</span></a><o:p></o:p></span></p>
  </td>
  <td valign=3D"top" style=3D"padding: 0in; font-style: inherit; font-varia=
nt: inherit; font-stretch: inherit; font-size: inherit; line-height: inheri=
t;">
  <p style=3D"font-weight: inherit; margin: 0in 0in 12pt; vertical-align: b=
aseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;=
 font-size: inherit; line-height: inherit;"><span style=3D"font-size:11.5pt=
;font-family:inherit;mso-bidi-font-family:Arial;
  color:#242729"></span><span style=3D"font-style:inherit;font-variant:inhe=
rit;
  font-stretch: inherit;font-size:inherit;line-height:inherit">Proposing a
  =C2=A0way I can =C2=A0take advantage of override keyword without writing
  override after each method.<o:p></o:p></span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 12pt; vertical-align: b=
aseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;=
 font-size: inherit; line-height: inherit;"><span style=3D"font-size:11.5pt=
;font-family:inherit;mso-bidi-font-family:Arial;
  color:#242729">I have couple of points to desire such a thing<o:p></o:p><=
/span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 0.0001pt 22.5pt; text-i=
ndent: -0.25in; vertical-align: baseline; font-style: inherit; font-variant=
: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit;=
"><!--[if !supportLists]--><span style=3D"font-size:10.0pt;mso-bidi-font-si=
ze:11.5pt;font-family:Symbol;
  mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol;color:#242729"=
>=C2=B7<span style=3D"font-variant-numeric: normal; font-stretch: normal; f=
ont-size: 7pt; line-height: normal; font-family: &quot;Times New Roman&quot=
;;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
  </span></span><!--[endif]--><span style=3D"font-size:11.5pt;font-family:
  inherit;mso-bidi-font-family:Arial;color:#242729">Its error prone to mark
  each method override when you are dealing with legacy code and introducin=
g
  the override keyword in the existing class<o:p></o:p></span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 0.0001pt 22.5pt; text-i=
ndent: -0.25in; vertical-align: baseline; font-style: inherit; font-variant=
: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit;=
"><!--[if !supportLists]--><span style=3D"font-size:10.0pt;mso-bidi-font-si=
ze:11.5pt;font-family:Symbol;
  mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol;color:#242729"=
>=C2=B7<span style=3D"font-variant-numeric: normal; font-stretch: normal; f=
ont-size: 7pt; line-height: normal; font-family: &quot;Times New Roman&quot=
;;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
  </span></span><!--[endif]--><span style=3D"font-size:11.5pt;font-family:
  inherit;mso-bidi-font-family:Arial;color:#242729">You have too many overr=
ide
  methods<o:p></o:p></span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 0.0001pt 22.5pt; text-i=
ndent: -0.25in; vertical-align: baseline; font-style: inherit; font-variant=
: inherit; font-stretch: inherit; font-size: inherit; line-height: inherit;=
"><!--[if !supportLists]--><span style=3D"font-size:10.0pt;mso-bidi-font-si=
ze:11.5pt;font-family:Symbol;
  mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol;color:#242729"=
>=C2=B7<span style=3D"font-variant-numeric: normal; font-stretch: normal; f=
ont-size: 7pt; line-height: normal; font-family: &quot;Times New Roman&quot=
;;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
  </span></span><!--[endif]--><span style=3D"font-size:11.5pt;font-family:
  inherit;mso-bidi-font-family:Arial;color:#242729">Override methods maybe
  scattered around in class declaration mangled with bunch of other methods=
 its
  good to group them as a good practice.<o:p></o:p></span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 12pt; vertical-align: b=
aseline; font-style: inherit; font-variant: inherit; font-stretch: inherit;=
 font-size: inherit; line-height: inherit;"><span style=3D"font-size:11.5pt=
;font-family:inherit;mso-bidi-font-family:Arial;
  color:#242729">I am looking for something like override block using scope=
,
  when any method is part of this block its same as writing override after =
the
  method signature.<o:p></o:p></span></p>
  <p style=3D"font-weight: inherit; margin: 0in 0in 0.0001pt; vertical-alig=
n: baseline; font-style: inherit; font-variant: inherit; font-stretch: inhe=
rit; font-size: inherit; line-height: inherit;"><span style=3D"font-size:in=
herit;
  font-style:inherit;font-variant-ligatures: inherit;font-variant-caps: inh=
erit;
  font-weight:inherit"><span style=3D"font-size: 11.5pt; font-family: inher=
it; color: rgb(36, 39, 41); border-width: 1pt; border-style: none; border-c=
olor: windowtext; padding: 0in;">e.g.</span></span><span style=3D"font-size=
:11.5pt;font-family:inherit;mso-bidi-font-family:Arial;
  color:#242729"><o:p></o:p></span></p>
  <pre style=3D"font-weight: inherit; background: rgb(239, 240, 241); verti=
cal-align: baseline; font-style: inherit; font-variant: inherit; font-stret=
ch: inherit; line-height: inherit; max-height: 600px; word-wrap: normal; ov=
erflow: auto;"><span class=3D"kwd"><span style=3D"font-family: inherit; col=
or: rgb(16, 16, 148); border-width: 1pt; border-style: none; border-color: =
windowtext; padding: 0in;">class</span></span><span class=3D"pln"><span sty=
le=3D"font-family: inherit; color: rgb(48, 51, 54); border-width: 1pt; bord=
er-style: none; border-color: windowtext; padding: 0in;"> derived: public b=
ase<o:p></o:p></span></span></pre><pre style=3D"font-weight: inherit; backg=
round: rgb(239, 240, 241); vertical-align: baseline;"><span class=3D"pun"><=
span style=3D"font-family: inherit; color: rgb(48, 51, 54); border-width: 1=
pt; border-style: none; border-color: windowtext; padding: 0in;">{</span></=
span><span class=3D"pln"><span style=3D"font-family: inherit; color: rgb(48=
, 51, 54); border-width: 1pt; border-style: none; border-color: windowtext;=
 padding: 0in;"><o:p></o:p></span></span></pre><span style=3D"font-style: i=
nherit; font-variant: inherit; font-stretch: inherit; font-size: inherit; l=
ine-height: inherit;"><pre style=3D"font-weight: inherit; background: rgb(2=
39, 240, 241); vertical-align: baseline;"><span class=3D"pln"><span style=
=3D"font-family: inherit; color: rgb(48, 51, 54); border-width: 1pt; border=
-style: none; border-color: windowtext; padding: 0in;">=C2=A0 =C2=A0</span>=
</span><span class=3D"kwd"></span><span style=3D"font-family: inherit; colo=
r: rgb(16, 16, 148); border-width: 1pt; border-style: none; border-color: w=
indowtext; padding: 0in;"><span style=3D"font-style:inherit;font-variant:in=
herit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">publ=
ic</span></span><span class=3D"pun"><span style=3D"font-family: inherit; co=
lor: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: =
windowtext; padding: 0in;"><span style=3D"font-style:inherit;font-variant:i=
nherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">:</s=
pan></span></span><span class=3D"pln"><span style=3D"font-family: inherit; =
color: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color=
: windowtext; padding: 0in;"><o:p></o:p></span></span></pre><span style=3D"=
font-style: inherit; font-variant: inherit; font-stretch: inherit; font-siz=
e: inherit; line-height: inherit;"><pre style=3D"font-weight: inherit; back=
ground: rgb(239, 240, 241); vertical-align: baseline;"><span class=3D"pln">=
<span style=3D"font-family: inherit; color: rgb(48, 51, 54); border-width: =
1pt; border-style: none; border-color: windowtext; padding: 0in;"><o:p>=C2=
=A0</o:p></span></span></pre><pre style=3D"background: rgb(239, 240, 241); =
vertical-align: baseline;"><span class=3D"pln"><span style=3D"font-family: =
inherit; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; bor=
der-color: windowtext; padding: 0in;"><span style=3D"font-weight: inherit;"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span><b>override</b><span style=3D"font-w=
eight: inherit;"> </span></span></span><span class=3D"pun" style=3D"font-we=
ight: inherit;"><span style=3D"font-family: inherit; color: rgb(48, 51, 54)=
; border-width: 1pt; border-style: none; border-color: windowtext; padding:=
 0in;"><span style=3D"font-style:inherit;font-variant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">{</s=
pan></span></span><span class=3D"pln" style=3D"font-weight: inherit;"><span=
 style=3D"font-family: inherit; color: rgb(48, 51, 54); border-width: 1pt; =
border-style: none; border-color: windowtext; padding: 0in;"><o:p></o:p></s=
pan></span></pre><span style=3D"font-weight: inherit; font-style: inherit; =
font-variant: inherit; font-stretch: inherit; font-size: inherit; line-heig=
ht: inherit;"><pre style=3D"background:#EFF0F1;vertical-align:
  baseline"><span class=3D"pln"><span style=3D"font-family: inherit; color:=
 rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: wind=
owtext; padding: 0in;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0 =C2=A0</span></span><span class=3D"typ"></span><span =
style=3D"font-family: inherit; color: rgb(43, 145, 175); border-width: 1pt;=
 border-style: none; border-color: windowtext; padding: 0in;"><span style=
=3D"font-style:inherit;font-variant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">int<=
/span></span><span class=3D"pln"><span style=3D"font-family: inherit; color=
: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: win=
dowtext; padding: 0in;"><span style=3D"font-style:inherit;font-variant:inhe=
rit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit"> bla=
h</span></span></span><span class=3D"pun"><span style=3D"font-family: inher=
it; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-c=
olor: windowtext; padding: 0in;"><span style=3D"font-style:inherit;font-var=
iant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">();<=
/span></span></span><span class=3D"pln"><span style=3D"font-family: inherit=
; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-col=
or: windowtext; padding: 0in;"><o:p></o:p></span></span></pre><span style=
=3D"font-style:inherit;
  font-variant:inherit;font-weight:inherit;font-stretch: inherit;font-size:
  inherit;line-height:inherit"><pre style=3D"background:#EFF0F1;vertical-al=
ign:
  baseline"><span class=3D"pln"><span style=3D"font-family: inherit; color:=
 rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: wind=
owtext; padding: 0in;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0</span></span><span class=3D"kwd"></span>=
<span style=3D"font-family: inherit; color: rgb(16, 16, 148); border-width:=
 1pt; border-style: none; border-color: windowtext; padding: 0in;"><span st=
yle=3D"font-style:inherit;font-variant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">void=
</span></span><span class=3D"pln"><span style=3D"font-family: inherit; colo=
r: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: wi=
ndowtext; padding: 0in;"><span style=3D"font-style:inherit;font-variant:inh=
erit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit"> bla=
hBlah</span></span></span><span class=3D"pun"><span style=3D"font-family: i=
nherit; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; bord=
er-color: windowtext; padding: 0in;"><span style=3D"font-style:inherit;font=
-variant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">();<=
/span></span></span><span class=3D"pln"><span style=3D"font-family: inherit=
; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-col=
or: windowtext; padding: 0in;"><o:p></o:p></span></span></pre><span style=
=3D"font-style:inherit;
  font-variant:inherit;font-weight:inherit;font-stretch: inherit;font-size:
  inherit;line-height:inherit"><pre style=3D"background:#EFF0F1;vertical-al=
ign:
  baseline"><span class=3D"pln"><span style=3D"font-family: inherit; color:=
 rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: wind=
owtext; padding: 0in;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0</span></span><span class=3D"pun"><=
/span><span style=3D"font-family: inherit; color: rgb(48, 51, 54); border-w=
idth: 1pt; border-style: none; border-color: windowtext; padding: 0in;"><sp=
an style=3D"font-style:inherit;font-variant:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">..</=
span></span><span class=3D"pln"><span style=3D"font-family: inherit; color:=
 rgb(48, 51, 54); border-width: 1pt; border-style: none; border-color: wind=
owtext; padding: 0in;"><span style=3D"font-style:inherit;font-variant:inher=
it;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit"> and=
 so on<o:p></o:p></span></span></span></pre><pre style=3D"background:#EFF0F=
1;vertical-align:baseline"><span class=3D"pln"><span style=3D"font-family: =
inherit; color: rgb(48, 51, 54); border-width: 1pt; border-style: none; bor=
der-color: windowtext; padding: 0in;">=C2=A0=C2=A0=C2=A0=C2=A0 =C2=A0</span=
></span><span class=3D"pun"><span style=3D"font-family: inherit; color: rgb=
(48, 51, 54); border-width: 1pt; border-style: none; border-color: windowte=
xt; padding: 0in;"><span style=3D"font-style:inherit;font-variant:inherit;f=
ont-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">}</s=
pan></span></span></pre><span style=3D"font-style:inherit;
  font-variant:inherit;font-weight:inherit;font-stretch: inherit;font-size:
  inherit;line-height:inherit"><pre style=3D"background:#EFF0F1;vertical-al=
ign:
  baseline"><span class=3D"pun"></span><span style=3D"font-family: inherit;=
 color: rgb(48, 51, 54); border-width: 1pt; border-style: none; border-colo=
r: windowtext; padding: 0in;"><span style=3D"font-style:inherit;font-varian=
t:inherit;font-weight:
  inherit;font-stretch: inherit;font-size:inherit;line-height:inherit">};</=
span></span><span style=3D"font-family:Consolas;color:#393318"><o:p></o:p><=
/span></pre></span></span></span></span></span></span></td>
 </tr>
</tbody></table>

<p class=3D"MsoNormal"><o:p>=C2=A0</o:p></p>

<p class=3D"MsoNormal">The above code is supposed to be same as writing ove=
rride
after each method.<o:p></o:p></p><p class=3D"MsoNormal"><br></p><p class=3D=
"MsoNormal">Thanks</p><p class=3D"MsoNormal">Husen Jiruwala</p></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/9ec15216-718e-4733-8ae0-9e23fd223fd0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9ec15216-718e-4733-8ae0-9e23fd223fd0=
%40isocpp.org</a>.<br />

------=_Part_4800_43728629.1498041749095--

------=_Part_4799_1697975553.1498041749094--

.