Topic: Idea to propose change to C++ language


Author: openmysourcecode@gmail.com
Date: Mon, 14 Jul 2014 18:49:54 -0700 (PDT)
Raw View
------=_Part_882_8877588.1405388994871
Content-Type: text/plain; charset=UTF-8

In C++, one can inherit multiple parent classes into a subclass to compose
them together, but if one parent implements a set of virtual functions
found in the other parent the implementation won't count unless the
subclass implements it. I propose that if this happens, that rather than
behavior being undefined, that the implemented versions of the virtual
functions from the co-parent count as implementations of the co-parent's
virtual functions. For example:

#include <iostream>


using namespace std;


class Dad

{

public:

    virtual void foo ();

};

class Mom

{

public:

    static void foo ();

};


class Subclass : public Dad, public Mom

{

public:

    Subclass();

    // empty class otherwise...

};


Subclass::Subclass ()

{

    Dad::foo = Mom::foo; // doesn't work, would either as part of subclass definition, or in constructor.
    Subclass::foo = Mom::foo; // would also work

}


void Mom::foo ()

{

    cout << "This is foo in the Mom." << endl;

}


int main()

{

    MySubclass controller;

    controller.foo();

    return 0;

}


Before I submit such a proposal however, I was wondering what feedback my
fellow experienced C++ programmers would give to this construction. Would
composing designs like this be good? I have at least one idea of how to use
it but I wanted some feedback.

Thanks in advance,

Gino

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_882_8877588.1405388994871
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">In C++, one can inherit multiple parent classes into a sub=
class to compose them together, but if one parent implements a set of virtu=
al functions found in the other parent the implementation won't count unles=
s the subclass implements it. I propose that if this happens, that rather t=
han behavior being undefined, that the implemented versions of the virtual =
functions from the co-parent count as implementations of the co-parent's vi=
rtual functions. For example:<br><br><div class=3D"prettyprint" style=3D"bo=
rder: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color=
: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><pre><span style=3D" color:#000080;"><span style=3D"color: #800;" cla=
ss=3D"styled-by-prettify">#include</span></span><span style=3D" color:#c0c0=
c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span style=3D" color:#008000;"><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">&lt;iostream&gt;</span></span></pre><pre><span style=3D"f=
ont-family: Arial, Helvetica, sans-serif; color: rgb(128, 128, 0);"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span></span><span sty=
le=3D"font-family: Arial, Helvetica, sans-serif; color: rgb(192, 192, 192);=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span>=
<span style=3D"font-family: Arial, Helvetica, sans-serif; color: rgb(128, 1=
28, 0);"><span style=3D"color: #008;" class=3D"styled-by-prettify">namespac=
e</span></span><span style=3D"font-family: Arial, Helvetica, sans-serif; co=
lor: rgb(192, 192, 192);"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span style=3D"font-family: Arial, Helvetica, sans-=
serif; color: rgb(128, 0, 128);"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">std</span></span><span style=3D"font-family: Arial, Helveti=
ca, sans-serif; color: rgb(0, 0, 0);"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span></pre><pre><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></pre><pre><span style=3D" color:#808000=
;"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span></=
span><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Dad</span></span></pre><pre><span style=3D" color:#000000;"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></pre>=
<pre><span style=3D" color:#808000;"><span style=3D"color: #008;" class=3D"=
styled-by-prettify">public</span></span><span style=3D" color:#000000;"><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">:</span></span></pre=
><pre><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> &nbsp; &nbsp;</span></span><span style=3D" color:#808=
000;"><span style=3D"color: #008;" class=3D"styled-by-prettify">virtual</sp=
an></span><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span></span><span style=3D" color:#808000;"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><s=
pan style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span></span><span style=3D" font-style:italic; color:#00000=
0;"><span style=3D"color: #000;" class=3D"styled-by-prettify">foo</span></s=
pan><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span></span><span style=3D" color:#000000;"><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">();</span></span></pre><pr=
e><span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br><br></span></span></pre><pre><span style=3D" color:#808000;"><=
span style=3D"color: #008;" class=3D"styled-by-prettify">class</span></span=
><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Mom</span></span></pre><pre><span style=3D" color:#000000;"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></pre><pre=
><span style=3D" color:#808000;"><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">public</span></span><span style=3D" color:#000000;"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">:</span></span></pre><pr=
e><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> &nbsp; &nbsp;</span></span><span style=3D" color:#808000;=
"><span style=3D"color: #008;" class=3D"styled-by-prettify">static</span></=
span><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span></span><span style=3D" color:#808000;"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><span s=
tyle=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span></span><span style=3D" color:#000000;"><span style=3D"color=
: #000;" class=3D"styled-by-prettify">foo</span></span><span style=3D" colo=
r:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an></span><span style=3D" color:#000000;"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">();</span></span></pre><pre><span style=3D" color:=
#000000;"><span style=3D"color: #660;" class=3D"styled-by-prettify">};</spa=
n></span></pre><pre><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span></pre><pre><span style=3D" color:#808000;"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">class</span></span><span style=3D" =
color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span></span><span style=3D" color:#800080;"><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Subclass</span></span><span style=3D" color:#c=
0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/span><span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">:</span></span><span style=3D" color:#c0c0c0;"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span sty=
le=3D" color:#808000;"><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">public</span></span><span style=3D" color:#c0c0c0;"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D" col=
or:#800080;"><span style=3D"color: #606;" class=3D"styled-by-prettify">Dad<=
/span></span><span style=3D" color:#000000;"><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span></span><span style=3D" color:#c0c0c0;">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><s=
pan style=3D" color:#808000;"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">public</span></span><span style=3D" color:#c0c0c0;"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D" color:#800080;"><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Mom</span></span></pre><pre><span style=3D" color:#000000;"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></pre><pre><s=
pan style=3D" color:#808000;"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">public</span></span><span style=3D" color:#000000;"><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">:</span></span></pre><pre><=
span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> &nbsp; &nbsp;</span></span><span style=3D" color:#800080;"><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Subclass</span></s=
pan><span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">();</span></span></pre><pre><span style=3D" color:#c0c0c=
0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp; &nbsp=
;</span></span><span style=3D" color:#008000;"><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">//</span></span><span style=3D" color:#c0c0c0=
;"><span style=3D"color: #800;" class=3D"styled-by-prettify"> </span></span=
><span style=3D" color:#008000;"><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">empty</span></span><span style=3D" color:#c0c0c0;"><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify"> </span></span><span styl=
e=3D" color:#008000;"><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">class</span></span><span style=3D" color:#c0c0c0;"><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify"> </span></span><span style=3D" color=
:#008000;"><span style=3D"color: #800;" class=3D"styled-by-prettify">otherw=
ise...</span></span></pre><pre><span style=3D" color:#000000;"><span style=
=3D"color: #800;" class=3D"styled-by-prettify">};</span></span></pre><pre><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></pre><=
pre><span style=3D" color:#800080;"><span style=3D"color: #606;" class=3D"s=
tyled-by-prettify">Subclass</span></span><span style=3D" color:#000000;"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">::</span></span><sp=
an style=3D" color:#000000;"><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Subclass</span></span><span style=3D" color:#c0c0c0;"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D" color:#000000;"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">()</span></span></pre><pre><span style=3D" color:#000000;"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></pre><pre><s=
pan style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> &nbsp; &nbsp;</span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Dad</span></span><span style=3D" color:#000000;"><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">::</span></span><span styl=
e=3D" color:#800000;"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">foo</span></span><span style=3D" color:#c0c0c0;"><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span></span><span style=3D" color:#=
000000;"><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n></span><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span style=3D" color:#800080;"><spa=
n style=3D"color: #606;" class=3D"styled-by-prettify">Mom</span></span><spa=
n style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span></span><span style=3D" color:#800000;"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">foo</span></span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// doesn't work, would either as part of subclass d=
efinition, or in constructor.</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>&nbsp; &nbsp; </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">Subclass</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">foo</span><font color=3D"#666600"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Mom</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">foo</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">// would also work</span></font=
></pre><pre><span style=3D" color:#000000;"><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">}</span></span></pre><pre><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span></pre><pre><span style=3D" c=
olor:#808000;"><span style=3D"color: #008;" class=3D"styled-by-prettify">vo=
id</span></span><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span></span><span style=3D" color:#800080=
;"><span style=3D"color: #606;" class=3D"styled-by-prettify">Mom</span></sp=
an><span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">::</span></span><span style=3D" color:#000000;"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">foo</span></span><span sty=
le=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span></span><span style=3D" color:#000000;"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">()</span></span></pre><pre><span style=
=3D" color:#000000;"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span></span></pre><pre><span style=3D" color:#c0c0c0;"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp; &nbsp;</span></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify">cout</span><span =
style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span style=3D" color:#000000;"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">&lt;&lt;</span></span><span style=3D=
" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span></span><span style=3D" color:#008000;"><span style=3D"color: #080;=
" class=3D"styled-by-prettify">"This</span></span><span style=3D" color:#c0=
c0c0;"><span style=3D"color: #080;" class=3D"styled-by-prettify"> </span></=
span><span style=3D" color:#008000;"><span style=3D"color: #080;" class=3D"=
styled-by-prettify">is</span></span><span style=3D" color:#c0c0c0;"><span s=
tyle=3D"color: #080;" class=3D"styled-by-prettify"> </span></span><span sty=
le=3D" color:#008000;"><span style=3D"color: #080;" class=3D"styled-by-pret=
tify">foo</span></span><span style=3D" color:#c0c0c0;"><span style=3D"color=
: #080;" class=3D"styled-by-prettify"> </span></span><span style=3D" color:=
#008000;"><span style=3D"color: #080;" class=3D"styled-by-prettify">in</spa=
n></span><span style=3D" color:#c0c0c0;"><span style=3D"color: #080;" class=
=3D"styled-by-prettify"> </span></span><span style=3D" color:#008000;"><spa=
n style=3D"color: #080;" class=3D"styled-by-prettify">the</span></span><spa=
n style=3D" color:#c0c0c0;"><span style=3D"color: #080;" class=3D"styled-by=
-prettify"> Mom</span></span><span style=3D" color:#008000;"><span style=3D=
"color: #080;" class=3D"styled-by-prettify">."</span></span><span style=3D"=
 color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span></span><span style=3D" color:#000000;"><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;&lt;</span></span><span style=3D" color:#=
c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">endl</span=
><span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span></span></pre><pre><span style=3D" color:#000000;"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></span></p=
re><pre><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n></pre><pre><span style=3D" color:#808000;"><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">int</span></span><span style=3D" color:#c0c0c0;=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span>=
<span style=3D" color:#000000;"><span style=3D"color: #000;" class=3D"style=
d-by-prettify">main</span></span><span style=3D" color:#000000;"><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">()</span></span></pre><pre>=
<span style=3D" color:#000000;"><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span></span></pre><pre><span style=3D" color:#c0c0c0;"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> &nbsp; &nbsp;</spa=
n></span><span style=3D" color:#800080;"><span style=3D"color: #606;" class=
=3D"styled-by-prettify">MySubclass</span></span><span style=3D" color:#c0c0=
c0;"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></sp=
an><span style=3D" color:#000000;"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">controller</span></span><span style=3D" color:#000000;"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span></p=
re><pre><span style=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> &nbsp; &nbsp;</span></span><span style=3D" color:#=
000000;"><span style=3D"color: #000;" class=3D"styled-by-prettify">controll=
er</span></span><span style=3D" color:#000000;"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">.</span></span><span style=3D" font-style:it=
alic; color:#000000;"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">foo</span></span><span style=3D" color:#000000;"><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">();</span></span></pre><pre><span styl=
e=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> &nbsp; &nbsp;</span></span><span style=3D" color:#808000;"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">return</span></span><span s=
tyle=3D" color:#c0c0c0;"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span></span><span style=3D" color:#000080;"><span style=3D"color=
: #066;" class=3D"styled-by-prettify">0</span></span><span style=3D" color:=
#000000;"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
></span></pre><pre><span style=3D" color:#000000;"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">}</span></span></pre></div></code></div><=
br>Before I submit such a proposal however, I was wondering what feedback m=
y fellow experienced C++ programmers would give to this construction. Would=
 composing designs like this be good? I have at least one idea of how to us=
e it but I wanted some feedback.<div><br></div><div>Thanks in advance,</div=
><div><br></div><div>Gino</div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_882_8877588.1405388994871--

.


Author: David Krauss <potswa@gmail.com>
Date: Tue, 15 Jul 2014 11:50:52 +0800
Raw View
--Apple-Mail=_EF53C0A4-5507-4427-87E7-B05C86D5E3A3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-15, at 9:49 AM, openmysourcecode@gmail.com wrote:

> In C++, one can inherit multiple parent classes into a subclass to compos=
e them together, but if one parent implements a set of virtual functions fo=
und in the other parent the implementation won't count unless the subclass =
implements it. I propose that if this happens, that rather than behavior be=
ing undefined, that the implemented versions of the virtual functions from =
the co-parent count as implementations of the co-parent's virtual functions=
.. For example:

You can't override a virtual function using a static function. Only virtual=
 functions of a derived class may override virtual functions of the base.

Virtual functions of the same signature in independent base classes are unr=
elated and can't have an override relationship. A derived class function ma=
y override both simultaneously, though.

#include <iostream>

struct mom {
    virtual void foo() {}
};

struct dad {
    virtual void foo() {}
};

struct junior : mom, dad {
    virtual void foo() override {
        mom::foo(); // Use base class functionality. mom::foo() might as we=
ll be static here.
        std::cout << "junior\n";
    }
};

int main() {
junior q;
q.foo(); // Access function from derived class.
static_cast< mom & >( q ).foo(); // Same derived implementation is accessib=
le from either base.
static_cast< dad & >( q ).foo();

/*  These results are all unspecified, but the mix of true and false result=
s reveals
    how your implementation aliases the vtable entries. */
std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( & mom::=
foo ) =3D=3D static_cast< void (junior::*)() >( & dad::foo ) ) << '\n';
std::cout << std::boolalpha << ( & junior::foo =3D=3D static_cast< void (ju=
nior::*)() >( & dad::foo ) ) << '\n';
std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( & mom::=
foo ) =3D=3D & junior::foo ) << '\n';
}

Such virtual function name collisions may well be bugs, and IMHO it would b=
e nice if there were a facility to catch them.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_EF53C0A4-5507-4427-87E7-B05C86D5E3A3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;15, at 9:49 AM, <a href=3D"mailto:openmysourcecode@gmail.com=
">openmysourcecode@gmail.com</a> wrote:</div><br class=3D"Apple-interchange=
-newline"><blockquote type=3D"cite"><div dir=3D"ltr">In C++, one can inheri=
t multiple parent classes into a subclass to compose them together, but if =
one parent implements a set of virtual functions found in the other parent =
the implementation won't count unless the subclass implements it. I propose=
 that if this happens, that rather than behavior being undefined, that the =
implemented versions of the virtual functions from the co-parent count as i=
mplementations of the co-parent's virtual functions. For example:<br></div>=
</blockquote><div><br></div><div>You can&rsquo;t override a virtual functio=
n using a static function. Only virtual functions of a derived class may ov=
erride virtual functions of the base.</div><div><br></div><div>Virtual func=
tions of the same signature in independent base classes are unrelated and c=
an&rsquo;t have an override relationship. A derived class function may over=
ride both simultaneously, though.</div><div><br></div><div><font face=3D"Co=
urier">#include &lt;iostream&gt;<br><br>struct mom {<br>&nbsp; &nbsp;&nbsp;=
virtual void foo() {}<br>};<br><br>struct dad {<br>&nbsp; &nbsp;&nbsp;virtu=
al void foo() {}<br>};<br><br>struct junior : mom, dad {<br>&nbsp; &nbsp;&n=
bsp;virtual void foo() override {</font></div><div><font face=3D"Courier">&=
nbsp; &nbsp; &nbsp; &nbsp; mom::foo(); // Use base class functionality. mom=
::foo() might as well be static here.</font></div><div><font face=3D"Courie=
r">&nbsp; &nbsp; &nbsp; &nbsp; std::cout &lt;&lt; "junior\n&rdquo;;</font><=
/div><div><font face=3D"Courier">&nbsp; &nbsp; }<br>};<br><br>int main() {<=
br>junior q;<br>q.foo(); // Access function from derived class.<br>static_c=
ast&lt; mom &amp; &gt;( q ).foo(); // Same derived implementation is access=
ible from either base.<br>static_cast&lt; dad &amp; &gt;( q ).foo();<br><br=
>/* &nbsp;These results are all unspecified, but the mix of true and false =
results reveals</font></div><div><font face=3D"Courier">&nbsp; &nbsp; how y=
our implementation aliases the vtable entries. */<br>std::cout &lt;&lt; std=
::boolalpha &lt;&lt; ( static_cast&lt; void (junior::*)() &gt;( &amp; mom::=
foo ) =3D=3D static_cast&lt; void (junior::*)() &gt;( &amp; dad::foo )&nbsp=
;) &lt;&lt; '\n';<br>std::cout &lt;&lt; std::boolalpha &lt;&lt; ( &amp; jun=
ior::foo =3D=3D static_cast&lt; void (junior::*)() &gt;( &amp; dad::foo&nbs=
p;) ) &lt;&lt; '\n';<br>std::cout &lt;&lt; std::boolalpha &lt;&lt; ( static=
_cast&lt; void (junior::*)() &gt;( &amp; mom::foo ) =3D=3D &amp; junior::fo=
o&nbsp;) &lt;&lt; '\n';<br>}<br></font><br></div><div>Such virtual function=
 name collisions may well be bugs, and IMHO it would be nice if there were =
a facility to catch them.</div><div><br></div></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_EF53C0A4-5507-4427-87E7-B05C86D5E3A3--

.


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Tue, 15 Jul 2014 09:42:43 +0200
Raw View
--047d7bdca4688bcd4504fe368d84
Content-Type: text/plain; charset=UTF-8

I don't think your description matches the code, and it isn't clear to me
exactly what you are trying to do - but have you considered using
std::function:

class Dad

{

public:

    std::function<void()> foo;

};

class Mom

{

public:

    static void foo2 ();

};


class Subclass : public Dad, public Mom

{

public:

    Subclass();

    // empty class otherwise...

};


Subclass::Subclass ()

{

    foo = foo2;
}




On Tue, Jul 15, 2014 at 3:49 AM, <openmysourcecode@gmail.com> wrote:

> In C++, one can inherit multiple parent classes into a subclass to compose
> them together, but if one parent implements a set of virtual functions
> found in the other parent the implementation won't count unless the
> subclass implements it. I propose that if this happens, that rather than
> behavior being undefined, that the implemented versions of the virtual
> functions from the co-parent count as implementations of the co-parent's
> virtual functions. For example:
>
> #include <iostream>
>
>
> using namespace std;
>
>
> class Dad
>
> {
>
> public:
>
>     virtual void foo ();
>
> };
>
> class Mom
>
> {
>
> public:
>
>     static void foo ();
>
> };
>
>
> class Subclass : public Dad, public Mom
>
> {
>
> public:
>
>     Subclass();
>
>     // empty class otherwise...
>
> };
>
>
> Subclass::Subclass ()
>
> {
>
>     Dad::foo = Mom::foo; // doesn't work, would either as part of subclass definition, or in constructor.
>     Subclass::foo = Mom::foo; // would also work
>
> }
>
>
> void Mom::foo ()
>
> {
>
>     cout << "This is foo in the Mom." << endl;
>
> }
>
>
> int main()
>
> {
>
>     MySubclass controller;
>
>     controller.foo();
>
>     return 0;
>
> }
>
>
> Before I submit such a proposal however, I was wondering what feedback my
> fellow experienced C++ programmers would give to this construction. Would
> composing designs like this be good? I have at least one idea of how to use
> it but I wanted some feedback.
>
> Thanks in advance,
>
> Gino
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7bdca4688bcd4504fe368d84
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I don&#39;t think your description matches the code, and i=
t isn&#39;t clear to me exactly what you are trying to do - but have you co=
nsidered using std::function:<br><br><code><pre><span style=3D"color:rgb(12=
8,128,0)"><span style=3D"color:rgb(0,0,136)">class</span></span><span style=
=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(102,0,102)">Dad</span></span></pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>
<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,128,0)"><span st=
yle=3D"color:rgb(0,0,136)">std::function&lt;</span></span><span style=3D"co=
lor:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"></span></span><span =
style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">void()&gt=
;</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"color:=
rgb(0,0,0)"> </span></span><span style=3D"font-style:italic;color:rgb(0,0,0=
)"><span style=3D"color:rgb(0,0,0)">foo</span></span><span style=3D"color:r=
gb(192,192,192)"><span style=3D"color:rgb(0,0,0)"></span></span><span style=
=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">;</span></span><=
/pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
};</span><span style=3D"color:rgb(0,0,0)"><br><br></span></span></pre><pre>=
<span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">cla=
ss</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"color=
:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Mom</span></span>=
</pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>
<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,128,0)"><span st=
yle=3D"color:rgb(0,0,136)">static</span></span><span style=3D"color:rgb(192=
,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"c=
olor:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">void</span></span><=
span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </s=
pan></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,0,0)=
">foo</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"co=
lor:rgb(0,0,0)">2 </span></span><span style=3D"color:rgb(0,0,0)"><span styl=
e=3D"color:rgb(102,102,0)">();</span></span></pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
};</span></span></pre><pre><span style=3D"color:rgb(0,0,0)"><br></span></pr=
e><pre><span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,13=
6)">class</span></span><span style=3D"color:rgb(192,192,192)"><span style=
=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,0,128)"><=
span style=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"co=
lor:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span=
 style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">:</span></=
span><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> </span></span><span style=3D"color:rgb(128,128,0)"><span style=3D"color:=
rgb(0,0,136)">public</span></span><span style=3D"color:rgb(192,192,192)"><s=
pan style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,=
0,128)"><span style=3D"color:rgb(102,0,102)">Dad</span></span><span style=
=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">,</span></span><=
span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </s=
pan></span><span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,=
0,136)">public</span></span><span style=3D"color:rgb(192,192,192)"><span st=
yle=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,0,128)=
"><span style=3D"color:rgb(102,0,102)">Mom</span></span></pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>
<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,0,128)"><span st=
yle=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"color:rgb=
(0,0,0)"><span style=3D"color:rgb(102,102,0)">();</span></span></pre>
<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(0,128,0)"><span styl=
e=3D"color:rgb(136,0,0)">//</span></span><span style=3D"color:rgb(192,192,1=
92)"><span style=3D"color:rgb(136,0,0)"> </span></span><span style=3D"color=
:rgb(0,128,0)"><span style=3D"color:rgb(136,0,0)">empty</span></span><span =
style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(136,0,0)"> </span=
></span><span style=3D"color:rgb(0,128,0)"><span style=3D"color:rgb(136,0,0=
)">class</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D=
"color:rgb(136,0,0)"> </span></span><span style=3D"color:rgb(0,128,0)"><spa=
n style=3D"color:rgb(136,0,0)">otherwise...</span></span></pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(136,0,0)">};=
</span></span></pre><pre><span style=3D"color:rgb(0,0,0)"><br></span></pre>=
<pre><span style=3D"color:rgb(128,0,128)"><span style=3D"color:rgb(102,0,10=
2)">Subclass</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"c=
olor:rgb(102,102,0)">::</span></span><span style=3D"color:rgb(0,0,0)"><span=
 style=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"color:=
rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span sty=
le=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">()</span></spa=
n></pre>
<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(192,192,192)"><span styl=
e=3D"color:rgb(0,0,0)"> =C2=A0 =C2=A0</span><span style=3D"color:rgb(102,0,=
102)"></span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:r=
gb(102,102,0)"></span></span><span style=3D"color:rgb(128,0,0)"><span style=
=3D"color:rgb(0,0,0)">foo</span></span><span style=3D"color:rgb(192,192,192=
)"><span style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb=
(0,0,0)"><span style=3D"color:rgb(102,102,0)">=3D</span></span><span style=
=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span=
><span style=3D"color:rgb(128,0,128)"><span style=3D"color:rgb(102,0,102)">=
</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102=
,102,0)"></span></span><span style=3D"color:rgb(128,0,0)"><span style=3D"co=
lor:rgb(0,0,0)">foo2</span></span><span style=3D"color:rgb(102,102,0)">;</s=
pan><span style=3D"color:rgb(0,0,0)"><br>
<span style=3D"color:rgb(136,0,0)">}</span></span></pre></code><br></div><d=
iv class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Tue, Jul 15,=
 2014 at 3:49 AM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:openmysourcecode=
@gmail.com" target=3D"_blank">openmysourcecode@gmail.com</a>&gt;</span> wro=
te:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">In C++, one can inherit mul=
tiple parent classes into a subclass to compose them together, but if one p=
arent implements a set of virtual functions found in the other parent the i=
mplementation won&#39;t count unless the subclass implements it. I propose =
that if this happens, that rather than behavior being undefined, that the i=
mplemented versions of the virtual functions from the co-parent count as im=
plementations of the co-parent&#39;s virtual functions. For example:<br>
<br><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;ba=
ckground-color:rgb(250,250,250)"><code><div><pre><span style=3D"color:#0000=
80"><span style=3D"color:#800">#include</span></span><span style=3D"color:#=
c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#008=
000"><span style=3D"color:#080">&lt;iostream&gt;</span></span></pre>
<pre><span style=3D"font-family:Arial,Helvetica,sans-serif;color:rgb(128,12=
8,0)"><span style=3D"color:#000"><br></span><span style=3D"color:#008">usin=
g</span></span><span style=3D"font-family:Arial,Helvetica,sans-serif;color:=
rgb(192,192,192)"><span style=3D"color:#000"> </span></span><span style=3D"=
font-family:Arial,Helvetica,sans-serif;color:rgb(128,128,0)"><span style=3D=
"color:#008">namespace</span></span><span style=3D"font-family:Arial,Helvet=
ica,sans-serif;color:rgb(192,192,192)"><span style=3D"color:#000"> </span><=
/span><span style=3D"font-family:Arial,Helvetica,sans-serif;color:rgb(128,0=
,128)"><span style=3D"color:#000">std</span></span><span style=3D"font-fami=
ly:Arial,Helvetica,sans-serif;color:rgb(0,0,0)"><span style=3D"color:#660">=
;</span></span><span style=3D"color:#000"><br>
</span></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span st=
yle=3D"color:#808000"><span style=3D"color:#008">class</span></span><span s=
tyle=3D"color:#c0c0c0"><span style=3D"color:#000"> </span><span style=3D"co=
lor:#606">Dad</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">v=
irtual</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000=
"> </span></span><span style=3D"color:#808000"><span style=3D"color:#008">v=
oid</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =
</span></span><span style=3D"font-style:italic;color:#000000"><span style=
=3D"color:#000">foo</span></span><span style=3D"color:#c0c0c0"><span style=
=3D"color:#000"> </span></span><span style=3D"color:#000000"><span style=3D=
"color:#660">();</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">};</span><spa=
n style=3D"color:#000"><br><br></span></span></pre><pre><span style=3D"colo=
r:#808000"><span style=3D"color:#008">class</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span><span style=3D"color:#606">M=
om</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">s=
tatic</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"=
> </span></span><span style=3D"color:#808000"><span style=3D"color:#008">vo=
id</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> <=
/span></span><span style=3D"color:#000000"><span style=3D"color:#000">foo</=
span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> </spa=
n></span><span style=3D"color:#000000"><span style=3D"color:#660">();</span=
></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">};</span></sp=
an></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">class</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=
=3D"color:#800080"><span style=3D"color:#606">Subclass</span></span><span s=
tyle=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span styl=
e=3D"color:#000000"><span style=3D"color:#660">:</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#808000"><span style=3D"color:#008">public</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#800080"><span style=3D"color:#606">Dad</span></span><span style=3D"=
color:#000000"><span style=3D"color:#660">,</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:=
#808000"><span style=3D"color:#008">public</span></span><span style=3D"colo=
r:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#=
800080"><span style=3D"color:#606">Mom</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#800080"><span style=3D"color:#606">S=
ubclass</span></span><span style=3D"color:#000000"><span style=3D"color:#66=
0">();</span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#008000"><span style=3D"color:#800">/=
/</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </=
span></span><span style=3D"color:#008000"><span style=3D"color:#800">empty<=
/span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </sp=
an></span><span style=3D"color:#008000"><span style=3D"color:#800">class</s=
pan></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </span=
></span><span style=3D"color:#008000"><span style=3D"color:#800">otherwise.=
...</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#800">};</span></sp=
an></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#800080"><span style=3D"color:#606">Subclass</span></span><span s=
tyle=3D"color:#000000"><span style=3D"color:#660">::</span></span><span sty=
le=3D"color:#000000"><span style=3D"color:#606">Subclass</span></span><span=
 style=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span st=
yle=3D"color:#000000"><span style=3D"color:#660">()</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span><span style=3D"color:#606">Dad</span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">::</span></span><span style=3D"c=
olor:#800000"><span style=3D"color:#000">foo</span></span><span style=3D"co=
lor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color=
:#000000"><span style=3D"color:#660">=3D</span></span><span style=3D"color:=
#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#80=
0080"><span style=3D"color:#606">Mom</span></span><span style=3D"color:#000=
000"><span style=3D"color:#660">::</span></span><span style=3D"color:#80000=
0"><span style=3D"color:#000">foo</span></span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#800">// doe=
sn&#39;t work, would either as part of subclass definition, or in construct=
or.</span><span style=3D"color:#000"><br>
=C2=A0 =C2=A0 </span><span style=3D"color:#606">Subclass</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">foo</span><font color=
=3D"#666600"><span style=3D"color:#000"> </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Mom=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">foo</=
span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#800">// would also work</span></font></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#800">}</span></spa=
n></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">void</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#800080"><span style=3D"color:#606">Mom</span></span><span style=3D"=
color:#000000"><span style=3D"color:#660">::</span></span><span style=3D"co=
lor:#000000"><span style=3D"color:#000">foo</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:=
#000000"><span style=3D"color:#660">()</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span></span><span style=3D"color:#000">cout</span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">&lt;&lt;</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=
=3D"color:#008000"><span style=3D"color:#080">&quot;This</span></span><span=
 style=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span st=
yle=3D"color:#008000"><span style=3D"color:#080">is</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=
=3D"color:#008000"><span style=3D"color:#080">foo</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=3D=
"color:#008000"><span style=3D"color:#080">in</span></span><span style=3D"c=
olor:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=3D"colo=
r:#008000"><span style=3D"color:#080">the</span></span><span style=3D"color=
:#c0c0c0"><span style=3D"color:#080"> Mom</span></span><span style=3D"color=
:#008000"><span style=3D"color:#080">.&quot;</span></span><span style=3D"co=
lor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color=
:#000000"><span style=3D"color:#660">&lt;&lt;</span></span><span style=3D"c=
olor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"colo=
r:#000">endl</span><span style=3D"color:#000000"><span style=3D"color:#660"=
>;</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">}</span></spa=
n></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">int</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#000000"><span style=3D"color:#000">main</span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">()</span></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span></span><span style=3D"color:#800080"><span style=3D"color:=
#606">MySubclass</span></span><span style=3D"color:#c0c0c0"><span style=3D"=
color:#000"> </span></span><span style=3D"color:#000000"><span style=3D"col=
or:#000">controller</span></span><span style=3D"color:#000000"><span style=
=3D"color:#660">;</span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#000000"><span style=3D"color:#000">c=
ontroller</span></span><span style=3D"color:#000000"><span style=3D"color:#=
660">.</span></span><span style=3D"font-style:italic;color:#000000"><span s=
tyle=3D"color:#000">foo</span></span><span style=3D"color:#000000"><span st=
yle=3D"color:#660">();</span></span></pre>
<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">r=
eturn</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"=
> </span></span><span style=3D"color:#000080"><span style=3D"color:#066">0<=
/span></span><span style=3D"color:#000000"><span style=3D"color:#660">;</sp=
an></span></pre>
<pre><span style=3D"color:#000000"><span style=3D"color:#660">}</span></spa=
n></pre></div></code></div><br>Before I submit such a proposal however, I w=
as wondering what feedback my fellow experienced C++ programmers would give=
 to this construction. Would composing designs like this be good? I have at=
 least one idea of how to use it but I wanted some feedback.<div>
<br></div><div>Thanks in advance,</div><div><br></div><div>Gino</div></div>=
<span class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
<br>
--- <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@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7bdca4688bcd4504fe368d84--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Tue, 15 Jul 2014 07:52:10 -0400
Raw View
--001a11337ec8b1ff1804fe3a097b
Content-Type: text/plain; charset=UTF-8

I suppose one could do that. But will the compiler complain if you dont
assign foo a function?
On Jul 15, 2014 3:42 AM, "Andrew Tomazos" <andrewtomazos@gmail.com> wrote:

> I don't think your description matches the code, and it isn't clear to me
> exactly what you are trying to do - but have you considered using
> std::function:
>
> class Dad
>
> {
>
> public:
>
>     std::function<void()> foo;
>
> };
>
> class Mom
>
> {
>
> public:
>
>     static void foo2 ();
>
> };
>
>
> class Subclass : public Dad, public Mom
>
> {
>
> public:
>
>     Subclass();
>
>     // empty class otherwise...
>
> };
>
>
> Subclass::Subclass ()
>
> {
>
>     foo = foo2;
> }
>
>
>
>
> On Tue, Jul 15, 2014 at 3:49 AM, <openmysourcecode@gmail.com> wrote:
>
>> In C++, one can inherit multiple parent classes into a subclass to
>> compose them together, but if one parent implements a set of virtual
>> functions found in the other parent the implementation won't count unless
>> the subclass implements it. I propose that if this happens, that rather
>> than behavior being undefined, that the implemented versions of the virtual
>> functions from the co-parent count as implementations of the co-parent's
>> virtual functions. For example:
>>
>> #include <iostream>
>>
>>
>> using namespace std;
>>
>>
>> class Dad
>>
>> {
>>
>> public:
>>
>>     virtual void foo ();
>>
>> };
>>
>> class Mom
>>
>> {
>>
>> public:
>>
>>     static void foo ();
>>
>> };
>>
>>
>> class Subclass : public Dad, public Mom
>>
>> {
>>
>> public:
>>
>>     Subclass();
>>
>>     // empty class otherwise...
>>
>> };
>>
>>
>> Subclass::Subclass ()
>>
>> {
>>
>>     Dad::foo = Mom::foo; // doesn't work, would either as part of subclass definition, or in constructor.
>>
>>     Subclass::foo = Mom::foo; // would also work
>>
>> }
>>
>>
>> void Mom::foo ()
>>
>> {
>>
>>     cout << "This is foo in the Mom." << endl;
>>
>> }
>>
>>
>> int main()
>>
>> {
>>
>>     MySubclass controller;
>>
>>     controller.foo();
>>
>>     return 0;
>>
>> }
>>
>>
>> Before I submit such a proposal however, I was wondering what feedback my
>> fellow experienced C++ programmers would give to this construction. Would
>> composing designs like this be good? I have at least one idea of how to use
>> it but I wanted some feedback.
>>
>> Thanks in advance,
>>
>> Gino
>>
>> --
>>
>> ---
>> 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.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">I suppose one could do that. But will the compiler complain =
if you dont assign foo a function?</p>
<div class=3D"gmail_quote">On Jul 15, 2014 3:42 AM, &quot;Andrew Tomazos&qu=
ot; &lt;<a href=3D"mailto:andrewtomazos@gmail.com">andrewtomazos@gmail.com<=
/a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr">I don&#39;t think your description matches the code, and i=
t isn&#39;t clear to me exactly what you are trying to do - but have you co=
nsidered using std::function:<br><br><code><pre><span style=3D"color:rgb(12=
8,128,0)"><span style=3D"color:rgb(0,0,136)">class</span></span><span style=
=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(102,0,102)">Dad</span></span></pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>

<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,128,0)"><span st=
yle=3D"color:rgb(0,0,136)">std::function&lt;</span></span><span style=3D"co=
lor:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"></span></span><span =
style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">void()&gt=
;</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"color:=
rgb(0,0,0)"> </span></span><span style=3D"font-style:italic;color:rgb(0,0,0=
)"><span style=3D"color:rgb(0,0,0)">foo</span></span><span style=3D"color:r=
gb(192,192,192)"><span style=3D"color:rgb(0,0,0)"></span></span><span style=
=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">;</span></span><=
/pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
};</span><span style=3D"color:rgb(0,0,0)"><br><br></span></span></pre><pre>=
<span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">cla=
ss</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"color=
:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,0,102)">Mom</span></span>=
</pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>

<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,128,0)"><span st=
yle=3D"color:rgb(0,0,136)">static</span></span><span style=3D"color:rgb(192=
,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"c=
olor:rgb(128,128,0)"><span style=3D"color:rgb(0,0,136)">void</span></span><=
span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </s=
pan></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(0,0,0)=
">foo</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D"co=
lor:rgb(0,0,0)">2 </span></span><span style=3D"color:rgb(0,0,0)"><span styl=
e=3D"color:rgb(102,102,0)">();</span></span></pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
};</span></span></pre><pre><span style=3D"color:rgb(0,0,0)"><br></span></pr=
e><pre><span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,0,13=
6)">class</span></span><span style=3D"color:rgb(192,192,192)"><span style=
=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,0,128)"><=
span style=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"co=
lor:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span=
 style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">:</span></=
span><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> </span></span><span style=3D"color:rgb(128,128,0)"><span style=3D"color:=
rgb(0,0,136)">public</span></span><span style=3D"color:rgb(192,192,192)"><s=
pan style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,=
0,128)"><span style=3D"color:rgb(102,0,102)">Dad</span></span><span style=
=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">,</span></span><=
span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </s=
pan></span><span style=3D"color:rgb(128,128,0)"><span style=3D"color:rgb(0,=
0,136)">public</span></span><span style=3D"color:rgb(192,192,192)"><span st=
yle=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb(128,0,128)=
"><span style=3D"color:rgb(102,0,102)">Mom</span></span></pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(128,128,0)"><span style=
=3D"color:rgb(0,0,136)">public</span></span><span style=3D"color:rgb(0,0,0)=
"><span style=3D"color:rgb(102,102,0)">:</span></span></pre>

<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(128,0,128)"><span st=
yle=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"color:rgb=
(0,0,0)"><span style=3D"color:rgb(102,102,0)">();</span></span></pre>

<pre><span style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)=
"> =C2=A0 =C2=A0</span></span><span style=3D"color:rgb(0,128,0)"><span styl=
e=3D"color:rgb(136,0,0)">//</span></span><span style=3D"color:rgb(192,192,1=
92)"><span style=3D"color:rgb(136,0,0)"> </span></span><span style=3D"color=
:rgb(0,128,0)"><span style=3D"color:rgb(136,0,0)">empty</span></span><span =
style=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(136,0,0)"> </span=
></span><span style=3D"color:rgb(0,128,0)"><span style=3D"color:rgb(136,0,0=
)">class</span></span><span style=3D"color:rgb(192,192,192)"><span style=3D=
"color:rgb(136,0,0)"> </span></span><span style=3D"color:rgb(0,128,0)"><spa=
n style=3D"color:rgb(136,0,0)">otherwise...</span></span></pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(136,0,0)">};=
</span></span></pre><pre><span style=3D"color:rgb(0,0,0)"><br></span></pre>=
<pre><span style=3D"color:rgb(128,0,128)"><span style=3D"color:rgb(102,0,10=
2)">Subclass</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"c=
olor:rgb(102,102,0)">::</span></span><span style=3D"color:rgb(0,0,0)"><span=
 style=3D"color:rgb(102,0,102)">Subclass</span></span><span style=3D"color:=
rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span><span sty=
le=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">()</span></spa=
n></pre>

<pre><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102,102,0)">=
{</span></span></pre><pre><span style=3D"color:rgb(192,192,192)"><span styl=
e=3D"color:rgb(0,0,0)"> =C2=A0 =C2=A0</span><span style=3D"color:rgb(102,0,=
102)"></span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:r=
gb(102,102,0)"></span></span><span style=3D"color:rgb(128,0,0)"><span style=
=3D"color:rgb(0,0,0)">foo</span></span><span style=3D"color:rgb(192,192,192=
)"><span style=3D"color:rgb(0,0,0)"> </span></span><span style=3D"color:rgb=
(0,0,0)"><span style=3D"color:rgb(102,102,0)">=3D</span></span><span style=
=3D"color:rgb(192,192,192)"><span style=3D"color:rgb(0,0,0)"> </span></span=
><span style=3D"color:rgb(128,0,128)"><span style=3D"color:rgb(102,0,102)">=
</span></span><span style=3D"color:rgb(0,0,0)"><span style=3D"color:rgb(102=
,102,0)"></span></span><span style=3D"color:rgb(128,0,0)"><span style=3D"co=
lor:rgb(0,0,0)">foo2</span></span><span style=3D"color:rgb(102,102,0)">;</s=
pan><span style=3D"color:rgb(0,0,0)"><br>

<span style=3D"color:rgb(136,0,0)">}</span></span></pre></code><br></div><d=
iv class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Tue, Jul 15,=
 2014 at 3:49 AM,  <span dir=3D"ltr">&lt;<a href=3D"mailto:openmysourcecode=
@gmail.com" target=3D"_blank">openmysourcecode@gmail.com</a>&gt;</span> wro=
te:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">In C++, one can inherit mul=
tiple parent classes into a subclass to compose them together, but if one p=
arent implements a set of virtual functions found in the other parent the i=
mplementation won&#39;t count unless the subclass implements it. I propose =
that if this happens, that rather than behavior being undefined, that the i=
mplemented versions of the virtual functions from the co-parent count as im=
plementations of the co-parent&#39;s virtual functions. For example:<br>

<br><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;ba=
ckground-color:rgb(250,250,250)"><code><div><pre><span style=3D"color:#0000=
80"><span style=3D"color:#800">#include</span></span><span style=3D"color:#=
c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#008=
000"><span style=3D"color:#080">&lt;iostream&gt;</span></span></pre>

<pre><span style=3D"font-family:Arial,Helvetica,sans-serif;color:rgb(128,12=
8,0)"><span style=3D"color:#000"><br></span><span style=3D"color:#008">usin=
g</span></span><span style=3D"font-family:Arial,Helvetica,sans-serif;color:=
rgb(192,192,192)"><span style=3D"color:#000"> </span></span><span style=3D"=
font-family:Arial,Helvetica,sans-serif;color:rgb(128,128,0)"><span style=3D=
"color:#008">namespace</span></span><span style=3D"font-family:Arial,Helvet=
ica,sans-serif;color:rgb(192,192,192)"><span style=3D"color:#000"> </span><=
/span><span style=3D"font-family:Arial,Helvetica,sans-serif;color:rgb(128,0=
,128)"><span style=3D"color:#000">std</span></span><span style=3D"font-fami=
ly:Arial,Helvetica,sans-serif;color:rgb(0,0,0)"><span style=3D"color:#660">=
;</span></span><span style=3D"color:#000"><br>

</span></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span st=
yle=3D"color:#808000"><span style=3D"color:#008">class</span></span><span s=
tyle=3D"color:#c0c0c0"><span style=3D"color:#000"> </span><span style=3D"co=
lor:#606">Dad</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">v=
irtual</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000=
"> </span></span><span style=3D"color:#808000"><span style=3D"color:#008">v=
oid</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =
</span></span><span style=3D"font-style:italic;color:#000000"><span style=
=3D"color:#000">foo</span></span><span style=3D"color:#c0c0c0"><span style=
=3D"color:#000"> </span></span><span style=3D"color:#000000"><span style=3D=
"color:#660">();</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">};</span><spa=
n style=3D"color:#000"><br><br></span></span></pre><pre><span style=3D"colo=
r:#808000"><span style=3D"color:#008">class</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span><span style=3D"color:#606">M=
om</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">s=
tatic</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"=
> </span></span><span style=3D"color:#808000"><span style=3D"color:#008">vo=
id</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> <=
/span></span><span style=3D"color:#000000"><span style=3D"color:#000">foo</=
span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> </spa=
n></span><span style=3D"color:#000000"><span style=3D"color:#660">();</span=
></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">};</span></sp=
an></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">class</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=
=3D"color:#800080"><span style=3D"color:#606">Subclass</span></span><span s=
tyle=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span styl=
e=3D"color:#000000"><span style=3D"color:#660">:</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#808000"><span style=3D"color:#008">public</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#800080"><span style=3D"color:#606">Dad</span></span><span style=3D"=
color:#000000"><span style=3D"color:#660">,</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:=
#808000"><span style=3D"color:#008">public</span></span><span style=3D"colo=
r:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#=
800080"><span style=3D"color:#606">Mom</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#808000"><span style=3D"color:#008">publi=
c</span></span><span style=3D"color:#000000"><span style=3D"color:#660">:</=
span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#800080"><span style=3D"color:#606">S=
ubclass</span></span><span style=3D"color:#000000"><span style=3D"color:#66=
0">();</span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#008000"><span style=3D"color:#800">/=
/</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </=
span></span><span style=3D"color:#008000"><span style=3D"color:#800">empty<=
/span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </sp=
an></span><span style=3D"color:#008000"><span style=3D"color:#800">class</s=
pan></span><span style=3D"color:#c0c0c0"><span style=3D"color:#800"> </span=
></span><span style=3D"color:#008000"><span style=3D"color:#800">otherwise.=
...</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#800">};</span></sp=
an></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#800080"><span style=3D"color:#606">Subclass</span></span><span s=
tyle=3D"color:#000000"><span style=3D"color:#660">::</span></span><span sty=
le=3D"color:#000000"><span style=3D"color:#606">Subclass</span></span><span=
 style=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span st=
yle=3D"color:#000000"><span style=3D"color:#660">()</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span><span style=3D"color:#606">Dad</span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">::</span></span><span style=3D"c=
olor:#800000"><span style=3D"color:#000">foo</span></span><span style=3D"co=
lor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color=
:#000000"><span style=3D"color:#660">=3D</span></span><span style=3D"color:=
#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:#80=
0080"><span style=3D"color:#606">Mom</span></span><span style=3D"color:#000=
000"><span style=3D"color:#660">::</span></span><span style=3D"color:#80000=
0"><span style=3D"color:#000">foo</span></span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#800">// doe=
sn&#39;t work, would either as part of subclass definition, or in construct=
or.</span><span style=3D"color:#000"><br>

=C2=A0 =C2=A0 </span><span style=3D"color:#606">Subclass</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">foo</span><font color=
=3D"#666600"><span style=3D"color:#000"> </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Mom=
</span><span style=3D"color:#660">::</span><span style=3D"color:#000">foo</=
span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#800">// would also work</span></font></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#800">}</span></spa=
n></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">void</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#800080"><span style=3D"color:#606">Mom</span></span><span style=3D"=
color:#000000"><span style=3D"color:#660">::</span></span><span style=3D"co=
lor:#000000"><span style=3D"color:#000">foo</span></span><span style=3D"col=
or:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color:=
#000000"><span style=3D"color:#660">()</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span></span><span style=3D"color:#000">cout</span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">&lt;&lt;</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=
=3D"color:#008000"><span style=3D"color:#080">&quot;This</span></span><span=
 style=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span st=
yle=3D"color:#008000"><span style=3D"color:#080">is</span></span><span styl=
e=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=
=3D"color:#008000"><span style=3D"color:#080">foo</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=3D=
"color:#008000"><span style=3D"color:#080">in</span></span><span style=3D"c=
olor:#c0c0c0"><span style=3D"color:#080"> </span></span><span style=3D"colo=
r:#008000"><span style=3D"color:#080">the</span></span><span style=3D"color=
:#c0c0c0"><span style=3D"color:#080"> Mom</span></span><span style=3D"color=
:#008000"><span style=3D"color:#080">.&quot;</span></span><span style=3D"co=
lor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"color=
:#000000"><span style=3D"color:#660">&lt;&lt;</span></span><span style=3D"c=
olor:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D"colo=
r:#000">endl</span><span style=3D"color:#000000"><span style=3D"color:#660"=
>;</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">}</span></spa=
n></pre><pre><span style=3D"color:#000"><br></span></pre><pre><span style=
=3D"color:#808000"><span style=3D"color:#008">int</span></span><span style=
=3D"color:#c0c0c0"><span style=3D"color:#000"> </span></span><span style=3D=
"color:#000000"><span style=3D"color:#000">main</span></span><span style=3D=
"color:#000000"><span style=3D"color:#660">()</span></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">{</span></spa=
n></pre><pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=
=A0 =C2=A0</span></span><span style=3D"color:#800080"><span style=3D"color:=
#606">MySubclass</span></span><span style=3D"color:#c0c0c0"><span style=3D"=
color:#000"> </span></span><span style=3D"color:#000000"><span style=3D"col=
or:#000">controller</span></span><span style=3D"color:#000000"><span style=
=3D"color:#660">;</span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#000000"><span style=3D"color:#000">c=
ontroller</span></span><span style=3D"color:#000000"><span style=3D"color:#=
660">.</span></span><span style=3D"font-style:italic;color:#000000"><span s=
tyle=3D"color:#000">foo</span></span><span style=3D"color:#000000"><span st=
yle=3D"color:#660">();</span></span></pre>

<pre><span style=3D"color:#c0c0c0"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#808000"><span style=3D"color:#008">r=
eturn</span></span><span style=3D"color:#c0c0c0"><span style=3D"color:#000"=
> </span></span><span style=3D"color:#000080"><span style=3D"color:#066">0<=
/span></span><span style=3D"color:#000000"><span style=3D"color:#660">;</sp=
an></span></pre>

<pre><span style=3D"color:#000000"><span style=3D"color:#660">}</span></spa=
n></pre></div></code></div><br>Before I submit such a proposal however, I w=
as wondering what feedback my fellow experienced C++ programmers would give=
 to this construction. Would composing designs like this be good? I have at=
 least one idea of how to use it but I wanted some feedback.<div>

<br></div><div>Thanks in advance,</div><div><br></div><div>Gino</div></div>=
<span><font color=3D"#888888">

<p></p>

-- <br>
<br>
--- <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@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11337ec8b1ff1804fe3a097b--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Tue, 15 Jul 2014 07:53:53 -0400
Raw View
--001a11337ec8d2e36704fe3a0f9f
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

David, thats why my example explicitly assigned the defined function to the
virtual one in the class was to make it clear that i was using a base
classes foo to fulfill the virtual foo
On Jul 14, 2014 11:51 PM, "David Krauss" <potswa@gmail.com> wrote:

>
> On 2014=E2=80=9307=E2=80=9315, at 9:49 AM, openmysourcecode@gmail.com wro=
te:
>
> In C++, one can inherit multiple parent classes into a subclass to compos=
e
> them together, but if one parent implements a set of virtual functions
> found in the other parent the implementation won't count unless the
> subclass implements it. I propose that if this happens, that rather than
> behavior being undefined, that the implemented versions of the virtual
> functions from the co-parent count as implementations of the co-parent's
> virtual functions. For example:
>
>
> You can=E2=80=99t override a virtual function using a static function. On=
ly
> virtual functions of a derived class may override virtual functions of th=
e
> base.
>
> Virtual functions of the same signature in independent base classes are
> unrelated and can=E2=80=99t have an override relationship. A derived clas=
s function
> may override both simultaneously, though.
>
> #include <iostream>
>
> struct mom {
>     virtual void foo() {}
> };
>
> struct dad {
>     virtual void foo() {}
> };
>
> struct junior : mom, dad {
>     virtual void foo() override {
>         mom::foo(); // Use base class functionality. mom::foo() might as
> well be static here.
>         std::cout << "junior\n=E2=80=9D;
>     }
> };
>
> int main() {
> junior q;
> q.foo(); // Access function from derived class.
> static_cast< mom & >( q ).foo(); // Same derived implementation is
> accessible from either base.
> static_cast< dad & >( q ).foo();
>
> /*  These results are all unspecified, but the mix of true and false
> results reveals
>     how your implementation aliases the vtable entries. */
> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
> mom::foo ) =3D=3D static_cast< void (junior::*)() >( & dad::foo ) ) << '\=
n';
> std::cout << std::boolalpha << ( & junior::foo =3D=3D static_cast< void
> (junior::*)() >( & dad::foo ) ) << '\n';
> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
> mom::foo ) =3D=3D & junior::foo ) << '\n';
> }
>
> Such virtual function name collisions may well be bugs, and IMHO it would
> be nice if there were a facility to catch them.
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/=
unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<p dir=3D"ltr">David, thats why my example explicitly assigned the defined =
function to the virtual one in the class was to make it clear that i was us=
ing a base classes foo to fulfill the virtual foo</p>
<div class=3D"gmail_quote">On Jul 14, 2014 11:51 PM, &quot;David Krauss&quo=
t; &lt;<a href=3D"mailto:potswa@gmail.com">potswa@gmail.com</a>&gt; wrote:<=
br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margin:0=
 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style=3D"word-wrap:break-word"><br><div><div>On 2014=E2=80=9307=E2=80=
=9315, at 9:49 AM, <a href=3D"mailto:openmysourcecode@gmail.com" target=3D"=
_blank">openmysourcecode@gmail.com</a> wrote:</div><br><blockquote type=3D"=
cite"><div dir=3D"ltr">
In C++, one can inherit multiple parent classes into a subclass to compose =
them together, but if one parent implements a set of virtual functions foun=
d in the other parent the implementation won&#39;t count unless the subclas=
s implements it. I propose that if this happens, that rather than behavior =
being undefined, that the implemented versions of the virtual functions fro=
m the co-parent count as implementations of the co-parent&#39;s virtual fun=
ctions. For example:<br>
</div></blockquote><div><br></div><div>You can=E2=80=99t override a virtual=
 function using a static function. Only virtual functions of a derived clas=
s may override virtual functions of the base.</div><div><br></div><div>Virt=
ual functions of the same signature in independent base classes are unrelat=
ed and can=E2=80=99t have an override relationship. A derived class functio=
n may override both simultaneously, though.</div>
<div><br></div><div><font face=3D"Courier">#include &lt;iostream&gt;<br><br=
>struct mom {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>stru=
ct dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>struct ju=
nior : mom, dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() override {</font=
></div>
<div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 mom::foo(); // Use =
base class functionality. mom::foo() might as well be static here.</font></=
div><div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout &lt;&=
lt; &quot;junior\n=E2=80=9D;</font></div><div><font face=3D"Courier">=C2=A0=
 =C2=A0 }<br>
};<br><br>int main() {<br>junior q;<br>q.foo(); // Access function from der=
ived class.<br>static_cast&lt; mom &amp; &gt;( q ).foo(); // Same derived i=
mplementation is accessible from either base.<br>static_cast&lt; dad &amp; =
&gt;( q ).foo();<br>
<br>/* =C2=A0These results are all unspecified, but the mix of true and fal=
se results reveals</font></div><div><font face=3D"Courier">=C2=A0 =C2=A0 ho=
w your implementation aliases the vtable entries. */<br>std::cout &lt;&lt; =
std::boolalpha &lt;&lt; ( static_cast&lt; void (junior::*)() &gt;( &amp; mo=
m::foo ) =3D=3D static_cast&lt; void (junior::*)() &gt;( &amp; dad::foo )=
=C2=A0) &lt;&lt; &#39;\n&#39;;<br>
std::cout &lt;&lt; std::boolalpha &lt;&lt; ( &amp; junior::foo =3D=3D stati=
c_cast&lt; void (junior::*)() &gt;( &amp; dad::foo=C2=A0) ) &lt;&lt; &#39;\=
n&#39;;<br>std::cout &lt;&lt; std::boolalpha &lt;&lt; ( static_cast&lt; voi=
d (junior::*)() &gt;( &amp; mom::foo ) =3D=3D &amp; junior::foo=C2=A0) &lt;=
&lt; &#39;\n&#39;;<br>
}<br></font><br></div><div>Such virtual function name collisions may well b=
e bugs, and IMHO it would be nice if there were a facility to catch them.</=
div><div><br></div></div></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11337ec8d2e36704fe3a0f9f--

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Wed, 16 Jul 2014 16:49:03 -0400
Raw View
--047d7b343394b909f204fe55a8fb
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

It would be nice if a single non-abstract final overrider in a base class
would become the final overrider in a derived class.  That is, given

    struct A { virtual void f() { }  };
    struct B { virtual void f() =3D 0; };
    struct C : A, B { };

right now C is abstract.  I would prefer that A::f become the
implementation of C::f instead of needing to do

    struct C : A, B { void f() { A::f(); };


On Tue, Jul 15, 2014 at 7:53 AM, Gino Vincenzini <openmysourcecode@gmail.co=
m
> wrote:

> David, thats why my example explicitly assigned the defined function to
> the virtual one in the class was to make it clear that i was using a base
> classes foo to fulfill the virtual foo
> On Jul 14, 2014 11:51 PM, "David Krauss" <potswa@gmail.com> wrote:
>
>>
>> On 2014=E2=80=9307=E2=80=9315, at 9:49 AM, openmysourcecode@gmail.com wr=
ote:
>>
>> In C++, one can inherit multiple parent classes into a subclass to
>> compose them together, but if one parent implements a set of virtual
>> functions found in the other parent the implementation won't count unles=
s
>> the subclass implements it. I propose that if this happens, that rather
>> than behavior being undefined, that the implemented versions of the virt=
ual
>> functions from the co-parent count as implementations of the co-parent's
>> virtual functions. For example:
>>
>>
>> You can=E2=80=99t override a virtual function using a static function. O=
nly
>> virtual functions of a derived class may override virtual functions of t=
he
>> base.
>>
>> Virtual functions of the same signature in independent base classes are
>> unrelated and can=E2=80=99t have an override relationship. A derived cla=
ss function
>> may override both simultaneously, though.
>>
>> #include <iostream>
>>
>> struct mom {
>>     virtual void foo() {}
>> };
>>
>> struct dad {
>>     virtual void foo() {}
>> };
>>
>> struct junior : mom, dad {
>>     virtual void foo() override {
>>         mom::foo(); // Use base class functionality. mom::foo() might as
>> well be static here.
>>         std::cout << "junior\n=E2=80=9D;
>>     }
>> };
>>
>> int main() {
>> junior q;
>> q.foo(); // Access function from derived class.
>> static_cast< mom & >( q ).foo(); // Same derived implementation is
>> accessible from either base.
>> static_cast< dad & >( q ).foo();
>>
>> /*  These results are all unspecified, but the mix of true and false
>> results reveals
>>     how your implementation aliases the vtable entries. */
>> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
>> mom::foo ) =3D=3D static_cast< void (junior::*)() >( & dad::foo ) ) << '=
\n';
>> std::cout << std::boolalpha << ( & junior::foo =3D=3D static_cast< void
>> (junior::*)() >( & dad::foo ) ) << '\n';
>> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
>> mom::foo ) =3D=3D & junior::foo ) << '\n';
>> }
>>
>> Such virtual function name collisions may well be bugs, and IMHO it woul=
d
>> be nice if there were a facility to catch them.
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> std-proposals+unsubscribe@isocpp.org.
>>
>> To post to this group, send email to std-proposals@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>  --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--047d7b343394b909f204fe55a8fb
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">It would be nice if a single non-abstract final overrider =
in a base class would become the final overrider in a derived class. =C2=A0=
That is, given<div><br></div><div><font face=3D"courier new, monospace">=C2=
=A0 =C2=A0 struct A { virtual void f() { } =C2=A0};</font></div>

<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 struct B { virtual=
 void f() =3D 0; };</font></div><div><font face=3D"courier new, monospace">=
=C2=A0 =C2=A0 struct C : A, B { };</font></div><div><br></div><div>right no=
w <font face=3D"courier new, monospace">C</font> is abstract. =C2=A0I would=
 prefer that <font face=3D"courier new, monospace">A::f</font> become the i=
mplementation of <font face=3D"courier new, monospace">C::f</font>=C2=A0ins=
tead of needing to do</div>

<div><br></div><div>=C2=A0 =C2=A0 <font face=3D"courier new, monospace">str=
uct C : A, B { void f() { A::f(); };</font></div></div><div class=3D"gmail_=
extra"><br><br><div class=3D"gmail_quote">On Tue, Jul 15, 2014 at 7:53 AM, =
Gino Vincenzini <span dir=3D"ltr">&lt;<a href=3D"mailto:openmysourcecode@gm=
ail.com" target=3D"_blank">openmysourcecode@gmail.com</a>&gt;</span> wrote:=
<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><p dir=3D"ltr">David, thats why my example e=
xplicitly assigned the defined function to the virtual one in the class was=
 to make it clear that i was using a base classes foo to fulfill the virtua=
l foo</p>


<div class=3D"gmail_quote"><div><div class=3D"h5">On Jul 14, 2014 11:51 PM,=
 &quot;David Krauss&quot; &lt;<a href=3D"mailto:potswa@gmail.com" target=3D=
"_blank">potswa@gmail.com</a>&gt; wrote:<br type=3D"attribution"></div></di=
v><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex">

<div><div class=3D"h5">
<div style=3D"word-wrap:break-word"><br><div><div>On 2014=E2=80=9307=E2=80=
=9315, at 9:49 AM, <a href=3D"mailto:openmysourcecode@gmail.com" target=3D"=
_blank">openmysourcecode@gmail.com</a> wrote:</div><br><blockquote type=3D"=
cite"><div dir=3D"ltr">


In C++, one can inherit multiple parent classes into a subclass to compose =
them together, but if one parent implements a set of virtual functions foun=
d in the other parent the implementation won&#39;t count unless the subclas=
s implements it. I propose that if this happens, that rather than behavior =
being undefined, that the implemented versions of the virtual functions fro=
m the co-parent count as implementations of the co-parent&#39;s virtual fun=
ctions. For example:<br>


</div></blockquote><div><br></div><div>You can=E2=80=99t override a virtual=
 function using a static function. Only virtual functions of a derived clas=
s may override virtual functions of the base.</div><div><br></div><div>Virt=
ual functions of the same signature in independent base classes are unrelat=
ed and can=E2=80=99t have an override relationship. A derived class functio=
n may override both simultaneously, though.</div>


<div><br></div><div><font face=3D"Courier">#include &lt;iostream&gt;<br><br=
>struct mom {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>stru=
ct dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>struct ju=
nior : mom, dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() override {</font=
></div>


<div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 mom::foo(); // Use =
base class functionality. mom::foo() might as well be static here.</font></=
div><div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout &lt;&=
lt; &quot;junior\n=E2=80=9D;</font></div><div><font face=3D"Courier">=C2=A0=
 =C2=A0 }<br>


};<br><br>int main() {<br>junior q;<br>q.foo(); // Access function from der=
ived class.<br>static_cast&lt; mom &amp; &gt;( q ).foo(); // Same derived i=
mplementation is accessible from either base.<br>static_cast&lt; dad &amp; =
&gt;( q ).foo();<br>


<br>/* =C2=A0These results are all unspecified, but the mix of true and fal=
se results reveals</font></div><div><font face=3D"Courier">=C2=A0 =C2=A0 ho=
w your implementation aliases the vtable entries. */<br>std::cout &lt;&lt; =
std::boolalpha &lt;&lt; ( static_cast&lt; void (junior::*)() &gt;( &amp; mo=
m::foo ) =3D=3D static_cast&lt; void (junior::*)() &gt;( &amp; dad::foo )=
=C2=A0) &lt;&lt; &#39;\n&#39;;<br>


std::cout &lt;&lt; std::boolalpha &lt;&lt; ( &amp; junior::foo =3D=3D stati=
c_cast&lt; void (junior::*)() &gt;( &amp; dad::foo=C2=A0) ) &lt;&lt; &#39;\=
n&#39;;<br>std::cout &lt;&lt; std::boolalpha &lt;&lt; ( static_cast&lt; voi=
d (junior::*)() &gt;( &amp; mom::foo ) =3D=3D &amp; junior::foo=C2=A0) &lt;=
&lt; &#39;\n&#39;;<br>


}<br></font><br></div><div>Such virtual function name collisions may well b=
e bugs, and IMHO it would be nice if there were a facility to catch them.</=
div><div><br></div></div></div>

<p></p>

-- <br>
<br>
--- <br></div></div>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>



To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@isocpp.org</a>.<div class=3D""><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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></blockquote></div><div class=3D"HOEnZb"><div class=3D"h5">

<p></p>

-- <br>
<br>
--- <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@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b343394b909f204fe55a8fb--

.


Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Thu, 17 Jul 2014 00:23:48 +0200
Raw View
--e89a8ff1ce126130c804fe56faca
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wed, Jul 16, 2014 at 10:49 PM, Hyman Rosen <hyman.rosen@gmail.com> wrote=
:

> It would be nice if a single non-abstract final overrider in a base class
> would become the final overrider in a derived class.  That is, given
>
>     struct A { virtual void f() { }  };
>     struct B { virtual void f() =3D 0; };
>     struct C : A, B { };
>
> right now C is abstract.  I would prefer that A::f become the
> implementation of C::f instead of needing to do
>
>     struct C : A, B { void f() { A::f(); };
>
>
Just a thought
I think that your suggestion might conflict with the following code that is
already valid:

    struct K { virtual void f() =3D 0 { /* actual implmentation */ } }; //
implementation is reacheable only to child types

    struct U : K { }; // U is abstract
    struct V : K { void f() override { K::f(); } }; // V uses K's
implementation, which





>
> On Tue, Jul 15, 2014 at 7:53 AM, Gino Vincenzini <
> openmysourcecode@gmail.com> wrote:
>
>> David, thats why my example explicitly assigned the defined function to
>> the virtual one in the class was to make it clear that i was using a bas=
e
>> classes foo to fulfill the virtual foo
>> On Jul 14, 2014 11:51 PM, "David Krauss" <potswa@gmail.com> wrote:
>>
>>>
>>> On 2014=E2=80=9307=E2=80=9315, at 9:49 AM, openmysourcecode@gmail.com w=
rote:
>>>
>>> In C++, one can inherit multiple parent classes into a subclass to
>>> compose them together, but if one parent implements a set of virtual
>>> functions found in the other parent the implementation won't count unle=
ss
>>> the subclass implements it. I propose that if this happens, that rather
>>> than behavior being undefined, that the implemented versions of the vir=
tual
>>> functions from the co-parent count as implementations of the co-parent'=
s
>>> virtual functions. For example:
>>>
>>>
>>> You can=E2=80=99t override a virtual function using a static function. =
Only
>>> virtual functions of a derived class may override virtual functions of =
the
>>> base.
>>>
>>> Virtual functions of the same signature in independent base classes are
>>> unrelated and can=E2=80=99t have an override relationship. A derived cl=
ass function
>>> may override both simultaneously, though.
>>>
>>> #include <iostream>
>>>
>>> struct mom {
>>>     virtual void foo() {}
>>> };
>>>
>>> struct dad {
>>>     virtual void foo() {}
>>> };
>>>
>>> struct junior : mom, dad {
>>>     virtual void foo() override {
>>>         mom::foo(); // Use base class functionality. mom::foo() might a=
s
>>> well be static here.
>>>         std::cout << "junior\n=E2=80=9D;
>>>     }
>>> };
>>>
>>> int main() {
>>> junior q;
>>> q.foo(); // Access function from derived class.
>>> static_cast< mom & >( q ).foo(); // Same derived implementation is
>>> accessible from either base.
>>> static_cast< dad & >( q ).foo();
>>>
>>> /*  These results are all unspecified, but the mix of true and false
>>> results reveals
>>>     how your implementation aliases the vtable entries. */
>>> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
>>> mom::foo ) =3D=3D static_cast< void (junior::*)() >( & dad::foo ) ) << =
'\n';
>>> std::cout << std::boolalpha << ( & junior::foo =3D=3D static_cast< void
>>> (junior::*)() >( & dad::foo ) ) << '\n';
>>> std::cout << std::boolalpha << ( static_cast< void (junior::*)() >( &
>>> mom::foo ) =3D=3D & junior::foo ) << '\n';
>>> }
>>>
>>> Such virtual function name collisions may well be bugs, and IMHO it
>>> would be nice if there were a facility to catch them.
>>>
>>>  --
>>>
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPi=
w/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, send an email to
>>> std-proposals+unsubscribe@isocpp.org.
>>>
>>> To post to this group, send email to std-proposals@isocpp.org.
>>> Visit this group at
>>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> email to std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>  --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Wed, Jul 16, 2014 at 10:49 PM, Hyman Rosen <span dir=3D"ltr">&lt=
;<a href=3D"mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rosen@gma=
il.com</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div dir=3D"ltr">It would be nice if a single non-abstract=
 final overrider in a base class would become the final overrider in a deri=
ved class. =C2=A0That is, given<div>
<br></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 struct A=
 { virtual void f() { } =C2=A0};</font></div>

<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 struct B { virtual=
 void f() =3D 0; };</font></div><div><font face=3D"courier new, monospace">=
=C2=A0 =C2=A0 struct C : A, B { };</font></div><div><br></div><div>right no=
w <font face=3D"courier new, monospace">C</font> is abstract. =C2=A0I would=
 prefer that <font face=3D"courier new, monospace">A::f</font> become the i=
mplementation of <font face=3D"courier new, monospace">C::f</font>=C2=A0ins=
tead of needing to do</div>


<div><br></div><div>=C2=A0 =C2=A0 <font face=3D"courier new, monospace">str=
uct C : A, B { void f() { A::f(); };</font></div></div><div class=3D""><div=
 class=3D"h5"><div class=3D"gmail_extra"><br></div></div></div></blockquote=
><div><br></div>
<div>Just a thought</div><div>I think that your suggestion might conflict w=
ith the following code that is already valid:</div><div><br></div><div>=C2=
=A0 =C2=A0 struct K { virtual void f() =3D 0 { /* actual implmentation */ }=
 }; // implementation is reacheable only to child types</div>
<div><br></div><div>=C2=A0 =C2=A0 struct U : K { }; // U is abstract</div><=
div>=C2=A0 =C2=A0 struct V : K { void f() override { K::f(); } }; // V uses=
 K&#39;s implementation, which<br></div><div><br></div><div><br></div><div>=
<br></div><div>=C2=A0</div>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><div class=3D""><div class=3D"h5"><div class=3D"gmail_extr=
a"><br>
<div class=3D"gmail_quote">On Tue, Jul 15, 2014 at 7:53 AM, Gino Vincenzini=
 <span dir=3D"ltr">&lt;<a href=3D"mailto:openmysourcecode@gmail.com" target=
=3D"_blank">openmysourcecode@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;p=
adding-left:1ex"><p dir=3D"ltr">David, thats why my example explicitly assi=
gned the defined function to the virtual one in the class was to make it cl=
ear that i was using a base classes foo to fulfill the virtual foo</p>



<div class=3D"gmail_quote"><div><div>On Jul 14, 2014 11:51 PM, &quot;David =
Krauss&quot; &lt;<a href=3D"mailto:potswa@gmail.com" target=3D"_blank">pots=
wa@gmail.com</a>&gt; wrote:<br type=3D"attribution"></div></div><blockquote=
 class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:=
1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left=
:1ex">


<div><div>
<div style=3D"word-wrap:break-word"><br><div><div>On 2014=E2=80=9307=E2=80=
=9315, at 9:49 AM, <a href=3D"mailto:openmysourcecode@gmail.com" target=3D"=
_blank">openmysourcecode@gmail.com</a> wrote:</div><br><blockquote type=3D"=
cite"><div dir=3D"ltr">



In C++, one can inherit multiple parent classes into a subclass to compose =
them together, but if one parent implements a set of virtual functions foun=
d in the other parent the implementation won&#39;t count unless the subclas=
s implements it. I propose that if this happens, that rather than behavior =
being undefined, that the implemented versions of the virtual functions fro=
m the co-parent count as implementations of the co-parent&#39;s virtual fun=
ctions. For example:<br>



</div></blockquote><div><br></div><div>You can=E2=80=99t override a virtual=
 function using a static function. Only virtual functions of a derived clas=
s may override virtual functions of the base.</div><div><br></div><div>Virt=
ual functions of the same signature in independent base classes are unrelat=
ed and can=E2=80=99t have an override relationship. A derived class functio=
n may override both simultaneously, though.</div>



<div><br></div><div><font face=3D"Courier">#include &lt;iostream&gt;<br><br=
>struct mom {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>stru=
ct dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() {}<br>};<br><br>struct ju=
nior : mom, dad {<br>=C2=A0 =C2=A0=C2=A0virtual void foo() override {</font=
></div>



<div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 mom::foo(); // Use =
base class functionality. mom::foo() might as well be static here.</font></=
div><div><font face=3D"Courier">=C2=A0 =C2=A0 =C2=A0 =C2=A0 std::cout &lt;&=
lt; &quot;junior\n=E2=80=9D;</font></div><div><font face=3D"Courier">=C2=A0=
 =C2=A0 }<br>



};<br><br>int main() {<br>junior q;<br>q.foo(); // Access function from der=
ived class.<br>static_cast&lt; mom &amp; &gt;( q ).foo(); // Same derived i=
mplementation is accessible from either base.<br>static_cast&lt; dad &amp; =
&gt;( q ).foo();<br>



<br>/* =C2=A0These results are all unspecified, but the mix of true and fal=
se results reveals</font></div><div><font face=3D"Courier">=C2=A0 =C2=A0 ho=
w your implementation aliases the vtable entries. */<br>std::cout &lt;&lt; =
std::boolalpha &lt;&lt; ( static_cast&lt; void (junior::*)() &gt;( &amp; mo=
m::foo ) =3D=3D static_cast&lt; void (junior::*)() &gt;( &amp; dad::foo )=
=C2=A0) &lt;&lt; &#39;\n&#39;;<br>



std::cout &lt;&lt; std::boolalpha &lt;&lt; ( &amp; junior::foo =3D=3D stati=
c_cast&lt; void (junior::*)() &gt;( &amp; dad::foo=C2=A0) ) &lt;&lt; &#39;\=
n&#39;;<br>std::cout &lt;&lt; std::boolalpha &lt;&lt; ( static_cast&lt; voi=
d (junior::*)() &gt;( &amp; mom::foo ) =3D=3D &amp; junior::foo=C2=A0) &lt;=
&lt; &#39;\n&#39;;<br>



}<br></font><br></div><div>Such virtual function name collisions may well b=
e bugs, and IMHO it would be nice if there were a facility to catch them.</=
div><div><br></div></div></div>

<p></p>

-- <br>
<br>
--- <br></div></div>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>




To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@isocpp.org</a>.<div><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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></blockquote></div><div><div>

<p></p>

-- <br>
<br>
--- <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@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br>
<br>
--- <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@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--e89a8ff1ce126130c804fe56faca--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 17 Jul 2014 07:34:36 +0800
Raw View
--Apple-Mail=_30AA895F-FB6A-4E11-8B1D-846F1FB94307
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-17, at 4:49 AM, Hyman Rosen <hyman.rosen@gmail.com> wrote:

> It would be nice if a single non-abstract final overrider in a base class=
 would become the final overrider in a derived class.  That is, given
>=20
>     struct A { virtual void f() { }  };
>     struct B { virtual void f() =3D 0; };
>     struct C : A, B { };
>=20
> right now C is abstract.  I would prefer that A::f become the implementat=
ion of C::f instead of needing to do
>=20
>     struct C : A, B { void f() { A::f(); };

If A knows how to implement B, then it should be derived from B. If B has m=
ore state, then that abstract interface should be factored into a new base.

I don't think this feature does anything that can't already be done with re=
factoring, adding abstract (perhaps virtual) bases. It adds confusingly red=
undant ways to express things, and breaks some multiple inheritance code. T=
wo bases existing somewhere on the inheritance hierarchy implementing ident=
ical virtual signatures can coexist, but add an abstract base with the same=
 signature, and now the other bases both try to override it -- even if the =
new class was intended to remain abstract.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_30AA895F-FB6A-4E11-8B1D-846F1FB94307
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;17, at 4:49 AM, Hyman Rosen &lt;<a href=3D"mailto:hyman.rose=
n@gmail.com">hyman.rosen@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-i=
nterchange-newline"><blockquote type=3D"cite"><div dir=3D"ltr">It would be =
nice if a single non-abstract final overrider in a base class would become =
the final overrider in a derived class. &nbsp;That is, given<div><br></div>=
<div><font face=3D"courier new, monospace">&nbsp; &nbsp; struct A { virtual=
 void f() { } &nbsp;};</font></div>

<div><font face=3D"courier new, monospace">&nbsp; &nbsp; struct B { virtual=
 void f() =3D 0; };</font></div><div><font face=3D"courier new, monospace">=
&nbsp; &nbsp; struct C : A, B { };</font></div><div><br></div><div>right no=
w <font face=3D"courier new, monospace">C</font> is abstract. &nbsp;I would=
 prefer that <font face=3D"courier new, monospace">A::f</font> become the i=
mplementation of <font face=3D"courier new, monospace">C::f</font>&nbsp;ins=
tead of needing to do</div>

<div><br></div><div>&nbsp; &nbsp; <font face=3D"courier new, monospace">str=
uct C : A, B { void f() { A::f(); };</font></div></div></blockquote></div><=
br><div>If A knows how to implement B, then it should be derived from B. If=
 B has more state, then that abstract interface should be factored into a n=
ew base.</div><div><br></div><div>I don&rsquo;t think this feature does any=
thing that can&rsquo;t already be done with refactoring, adding abstract (p=
erhaps virtual) bases. It adds confusingly redundant ways to express things=
, and breaks some multiple inheritance code. Two bases existing somewhere o=
n the inheritance hierarchy implementing identical virtual signatures can c=
oexist, but add an abstract base with the same signature, and now the other=
 bases both try to override it &mdash; even if the new class was intended t=
o remain abstract.</div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_30AA895F-FB6A-4E11-8B1D-846F1FB94307--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 17 Jul 2014 02:48:13 +0300
Raw View
On 17 July 2014 02:34, David Krauss <potswa@gmail.com> wrote:
>
> On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen <hyman.rosen@gmail=
..com> wrote:
>
> It would be nice if a single non-abstract final overrider in a base class
> would become the final overrider in a derived class.  That is, given
>
>     struct A { virtual void f() { }  };
>     struct B { virtual void f() =3D 0; };
>     struct C : A, B { };
>
> right now C is abstract.  I would prefer that A::f become the implementat=
ion
> of C::f instead of needing to do
>
>     struct C : A, B { void f() { A::f(); };
>
>
> If A knows how to implement B, then it should be derived from B. If B has
> more state, then that abstract interface should be factored into a new ba=
se.

That's probably not the intention of the design.

Regardless of that, A says "I have a function, you don't have to override i=
t."
B says "I have a function, you _have_ to override it." C says "I'll inherit=
 both
of you". I disagree, STRONGLY, that C should just pick the impure function
of A. There's no way to tell what the user meant, so, as unfortunate as it =
may
seem, the _right_ solution is to issue a diagnostic asking the user "what?"=
..

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Thu, 17 Jul 2014 00:12:50 -0400
Raw View
--20cf307cfd0cd1a5a104fe5bdb2b
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

For one thing, Java does it this way.  If I had the same code in Java, with
"class C extends B implements A" then the implementation of f in B
satisfies the need to define an f for A.

In any case, I don't see how this proposal breaks anything; it only applies
if there is exactly one non-abstract final overrider, and the method can be
forced abstract by redeclaring it: struct C : A, B { virtual void f() =3D 0=
;
};


On Wed, Jul 16, 2014 at 7:48 PM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:

> On 17 July 2014 02:34, David Krauss <potswa@gmail.com> wrote:
> >
> > On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen <hyman.rosen@gma=
il.com> wrote:
> >
> > It would be nice if a single non-abstract final overrider in a base cla=
ss
> > would become the final overrider in a derived class.  That is, given
> >
> >     struct A { virtual void f() { }  };
> >     struct B { virtual void f() =3D 0; };
> >     struct C : A, B { };
> >
> > right now C is abstract.  I would prefer that A::f become the
> implementation
> > of C::f instead of needing to do
> >
> >     struct C : A, B { void f() { A::f(); };
> >
> >
> > If A knows how to implement B, then it should be derived from B. If B h=
as
> > more state, then that abstract interface should be factored into a new
> base.
>
> That's probably not the intention of the design.
>
> Regardless of that, A says "I have a function, you don't have to override
> it."
> B says "I have a function, you _have_ to override it." C says "I'll
> inherit both
> of you". I disagree, STRONGLY, that C should just pick the impure functio=
n
> of A. There's no way to tell what the user meant, so, as unfortunate as i=
t
> may
> seem, the _right_ solution is to issue a diagnostic asking the user
> "what?".
>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--20cf307cfd0cd1a5a104fe5bdb2b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">For one thing, Java does it this way. =C2=A0If I had the s=
ame code in Java, with &quot;class C extends B implements A&quot; then the =
implementation of f in B satisfies the need to define an f for A.<div><br><=
/div>

<div>In any case, I don&#39;t see how this proposal breaks anything; it onl=
y applies if there is exactly one non-abstract final overrider, and the met=
hod can be forced abstract by redeclaring it: struct C : A, B { virtual voi=
d f() =3D 0; };</div>

</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Wed,=
 Jul 16, 2014 at 7:48 PM, Ville Voutilainen <span dir=3D"ltr">&lt;<a href=
=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilainen=
@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D"">On 17 July 2014 02:34, David=
 Krauss &lt;<a href=3D"mailto:potswa@gmail.com">potswa@gmail.com</a>&gt; wr=
ote:<br>


&gt;<br>
&gt; On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen &lt;<a href=3D"=
mailto:hyman.rosen@gmail.com">hyman.rosen@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; It would be nice if a single non-abstract final overrider in a base cl=
ass<br>
&gt; would become the final overrider in a derived class. =C2=A0That is, gi=
ven<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct A { virtual void f() { } =C2=A0};<br>
&gt; =C2=A0 =C2=A0 struct B { virtual void f() =3D 0; };<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { };<br>
&gt;<br>
&gt; right now C is abstract. =C2=A0I would prefer that A::f become the imp=
lementation<br>
&gt; of C::f instead of needing to do<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { void f() { A::f(); };<br>
&gt;<br>
&gt;<br>
&gt; If A knows how to implement B, then it should be derived from B. If B =
has<br>
&gt; more state, then that abstract interface should be factored into a new=
 base.<br>
<br>
</div>That&#39;s probably not the intention of the design.<br>
<br>
Regardless of that, A says &quot;I have a function, you don&#39;t have to o=
verride it.&quot;<br>
B says &quot;I have a function, you _have_ to override it.&quot; C says &qu=
ot;I&#39;ll inherit both<br>
of you&quot;. I disagree, STRONGLY, that C should just pick the impure func=
tion<br>
of A. There&#39;s no way to tell what the user meant, so, as unfortunate as=
 it may<br>
seem, the _right_ solution is to issue a diagnostic asking the user &quot;w=
hat?&quot;.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<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%2Bunsubscribe@isocpp.org">std-propo=
sals+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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--20cf307cfd0cd1a5a104fe5bdb2b--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Thu, 17 Jul 2014 00:23:38 -0400
Raw View
--bcaec547ccdb43e42a04fe5c01f8
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hyman: thats what I was thinking but not in terms of java but exactly the
same concept. I dont know java but i couldnt think of any way that would
break anything because it would only apply in the scenario i described.
Class a says i have a method, you dont have to override it, b says i have a
method you HAVE to override it, c inherits from both and the compiler
assumes or the programmer can specify that A's implimentation fulfills b's
demand.
On Jul 17, 2014 12:13 AM, "Hyman Rosen" <hyman.rosen@gmail.com> wrote:

> For one thing, Java does it this way.  If I had the same code in Java,
> with "class C extends B implements A" then the implementation of f in B
> satisfies the need to define an f for A.
>
> In any case, I don't see how this proposal breaks anything; it only
> applies if there is exactly one non-abstract final overrider, and the
> method can be forced abstract by redeclaring it: struct C : A, B { virtua=
l
> void f() =3D 0; };
>
>
> On Wed, Jul 16, 2014 at 7:48 PM, Ville Voutilainen <
> ville.voutilainen@gmail.com> wrote:
>
>> On 17 July 2014 02:34, David Krauss <potswa@gmail.com> wrote:
>> >
>> > On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen <hyman.rosen@gm=
ail.com> wrote:
>> >
>> > It would be nice if a single non-abstract final overrider in a base
>> class
>> > would become the final overrider in a derived class.  That is, given
>> >
>> >     struct A { virtual void f() { }  };
>> >     struct B { virtual void f() =3D 0; };
>> >     struct C : A, B { };
>> >
>> > right now C is abstract.  I would prefer that A::f become the
>> implementation
>> > of C::f instead of needing to do
>> >
>> >     struct C : A, B { void f() { A::f(); };
>> >
>> >
>> > If A knows how to implement B, then it should be derived from B. If B
>> has
>> > more state, then that abstract interface should be factored into a new
>> base.
>>
>> That's probably not the intention of the design.
>>
>> Regardless of that, A says "I have a function, you don't have to overrid=
e
>> it."
>> B says "I have a function, you _have_ to override it." C says "I'll
>> inherit both
>> of you". I disagree, STRONGLY, that C should just pick the impure functi=
on
>> of A. There's no way to tell what the user meant, so, as unfortunate as
>> it may
>> seem, the _right_ solution is to issue a diagnostic asking the user
>> "what?".
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> email to std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>  --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/=
unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<p dir=3D"ltr">Hyman: thats what I was thinking but not in terms of java bu=
t exactly the same concept. I dont know java but i couldnt think of any way=
 that would break anything because it would only apply in the scenario i de=
scribed. Class a says i have a method, you dont have to override it, b says=
 i have a method you HAVE to override it, c inherits from both and the comp=
iler assumes or the programmer can specify that A&#39;s implimentation fulf=
ills b&#39;s demand. </p>

<div class=3D"gmail_quote">On Jul 17, 2014 12:13 AM, &quot;Hyman Rosen&quot=
; &lt;<a href=3D"mailto:hyman.rosen@gmail.com">hyman.rosen@gmail.com</a>&gt=
; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D=
"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr">For one thing, Java does it this way. =C2=A0If I had the s=
ame code in Java, with &quot;class C extends B implements A&quot; then the =
implementation of f in B satisfies the need to define an f for A.<div><br><=
/div>


<div>In any case, I don&#39;t see how this proposal breaks anything; it onl=
y applies if there is exactly one non-abstract final overrider, and the met=
hod can be forced abstract by redeclaring it: struct C : A, B { virtual voi=
d f() =3D 0; };</div>


</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Wed,=
 Jul 16, 2014 at 7:48 PM, Ville Voutilainen <span dir=3D"ltr">&lt;<a href=
=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilainen=
@gmail.com</a>&gt;</span> wrote:<br>


<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>On 17 July 2014 02:34, David Krauss &lt=
;<a href=3D"mailto:potswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>=
&gt; wrote:<br>



&gt;<br>
&gt; On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen &lt;<a href=3D"=
mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rosen@gmail.com</a>&g=
t; wrote:<br>
&gt;<br>
&gt; It would be nice if a single non-abstract final overrider in a base cl=
ass<br>
&gt; would become the final overrider in a derived class. =C2=A0That is, gi=
ven<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct A { virtual void f() { } =C2=A0};<br>
&gt; =C2=A0 =C2=A0 struct B { virtual void f() =3D 0; };<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { };<br>
&gt;<br>
&gt; right now C is abstract. =C2=A0I would prefer that A::f become the imp=
lementation<br>
&gt; of C::f instead of needing to do<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { void f() { A::f(); };<br>
&gt;<br>
&gt;<br>
&gt; If A knows how to implement B, then it should be derived from B. If B =
has<br>
&gt; more state, then that abstract interface should be factored into a new=
 base.<br>
<br>
</div>That&#39;s probably not the intention of the design.<br>
<br>
Regardless of that, A says &quot;I have a function, you don&#39;t have to o=
verride it.&quot;<br>
B says &quot;I have a function, you _have_ to override it.&quot; C says &qu=
ot;I&#39;ll inherit both<br>
of you&quot;. I disagree, STRONGLY, that C should just pick the impure func=
tion<br>
of A. There&#39;s no way to tell what the user meant, so, as unfortunate as=
 it may<br>
seem, the _right_ solution is to issue a diagnostic asking the user &quot;w=
hat?&quot;.<br>
<div><div><br>
--<br>
<br>
---<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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--bcaec547ccdb43e42a04fe5c01f8--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Thu, 17 Jul 2014 00:24:49 -0400
Raw View
--001a11c2a89e79929904fe5c0551
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Those who said it might cause a problem with existing code, can you give
any more specific examples?
On Jul 17, 2014 12:23 AM, "Gino Vincenzini" <openmysourcecode@gmail.com>
wrote:

> Hyman: thats what I was thinking but not in terms of java but exactly the
> same concept. I dont know java but i couldnt think of any way that would
> break anything because it would only apply in the scenario i described.
> Class a says i have a method, you dont have to override it, b says i have=
 a
> method you HAVE to override it, c inherits from both and the compiler
> assumes or the programmer can specify that A's implimentation fulfills b'=
s
> demand.
> On Jul 17, 2014 12:13 AM, "Hyman Rosen" <hyman.rosen@gmail.com> wrote:
>
>> For one thing, Java does it this way.  If I had the same code in Java,
>> with "class C extends B implements A" then the implementation of f in B
>> satisfies the need to define an f for A.
>>
>> In any case, I don't see how this proposal breaks anything; it only
>> applies if there is exactly one non-abstract final overrider, and the
>> method can be forced abstract by redeclaring it: struct C : A, B { virtu=
al
>> void f() =3D 0; };
>>
>>
>> On Wed, Jul 16, 2014 at 7:48 PM, Ville Voutilainen <
>> ville.voutilainen@gmail.com> wrote:
>>
>>> On 17 July 2014 02:34, David Krauss <potswa@gmail.com> wrote:
>>> >
>>> > On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen <hyman.rosen@g=
mail.com> wrote:
>>> >
>>> > It would be nice if a single non-abstract final overrider in a base
>>> class
>>> > would become the final overrider in a derived class.  That is, given
>>> >
>>> >     struct A { virtual void f() { }  };
>>> >     struct B { virtual void f() =3D 0; };
>>> >     struct C : A, B { };
>>> >
>>> > right now C is abstract.  I would prefer that A::f become the
>>> implementation
>>> > of C::f instead of needing to do
>>> >
>>> >     struct C : A, B { void f() { A::f(); };
>>> >
>>> >
>>> > If A knows how to implement B, then it should be derived from B. If B
>>> has
>>> > more state, then that abstract interface should be factored into a ne=
w
>>> base.
>>>
>>> That's probably not the intention of the design.
>>>
>>> Regardless of that, A says "I have a function, you don't have to
>>> override it."
>>> B says "I have a function, you _have_ to override it." C says "I'll
>>> inherit both
>>> of you". I disagree, STRONGLY, that C should just pick the impure
>>> function
>>> of A. There's no way to tell what the user meant, so, as unfortunate as
>>> it may
>>> seem, the _right_ solution is to issue a diagnostic asking the user
>>> "what?".
>>>
>>> --
>>>
>>> ---
>>> 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.
>>> Visit this group at
>>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>>
>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to a topic in the
>> Google Groups "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> std-proposals+unsubscribe@isocpp.org.
>> To post to this group, send email to std-proposals@isocpp.org.
>> Visit this group at
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<p dir=3D"ltr">Those who said it might cause a problem with existing code, =
can you give any more specific examples?</p>
<div class=3D"gmail_quote">On Jul 17, 2014 12:23 AM, &quot;Gino Vincenzini&=
quot; &lt;<a href=3D"mailto:openmysourcecode@gmail.com">openmysourcecode@gm=
ail.com</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
<p dir=3D"ltr">Hyman: thats what I was thinking but not in terms of java bu=
t exactly the same concept. I dont know java but i couldnt think of any way=
 that would break anything because it would only apply in the scenario i de=
scribed. Class a says i have a method, you dont have to override it, b says=
 i have a method you HAVE to override it, c inherits from both and the comp=
iler assumes or the programmer can specify that A&#39;s implimentation fulf=
ills b&#39;s demand. </p>


<div class=3D"gmail_quote">On Jul 17, 2014 12:13 AM, &quot;Hyman Rosen&quot=
; &lt;<a href=3D"mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rose=
n@gmail.com</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex">

<div dir=3D"ltr">For one thing, Java does it this way. =C2=A0If I had the s=
ame code in Java, with &quot;class C extends B implements A&quot; then the =
implementation of f in B satisfies the need to define an f for A.<div><br><=
/div>



<div>In any case, I don&#39;t see how this proposal breaks anything; it onl=
y applies if there is exactly one non-abstract final overrider, and the met=
hod can be forced abstract by redeclaring it: struct C : A, B { virtual voi=
d f() =3D 0; };</div>



</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">On Wed,=
 Jul 16, 2014 at 7:48 PM, Ville Voutilainen <span dir=3D"ltr">&lt;<a href=
=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilainen=
@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div>On 17 July 2014 02:34, David Krauss &lt=
;<a href=3D"mailto:potswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>=
&gt; wrote:<br>




&gt;<br>
&gt; On 2014=E2=80=9307=E2=80=9317, at 4:49 AM, Hyman Rosen &lt;<a href=3D"=
mailto:hyman.rosen@gmail.com" target=3D"_blank">hyman.rosen@gmail.com</a>&g=
t; wrote:<br>
&gt;<br>
&gt; It would be nice if a single non-abstract final overrider in a base cl=
ass<br>
&gt; would become the final overrider in a derived class. =C2=A0That is, gi=
ven<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct A { virtual void f() { } =C2=A0};<br>
&gt; =C2=A0 =C2=A0 struct B { virtual void f() =3D 0; };<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { };<br>
&gt;<br>
&gt; right now C is abstract. =C2=A0I would prefer that A::f become the imp=
lementation<br>
&gt; of C::f instead of needing to do<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 struct C : A, B { void f() { A::f(); };<br>
&gt;<br>
&gt;<br>
&gt; If A knows how to implement B, then it should be derived from B. If B =
has<br>
&gt; more state, then that abstract interface should be factored into a new=
 base.<br>
<br>
</div>That&#39;s probably not the intention of the design.<br>
<br>
Regardless of that, A says &quot;I have a function, you don&#39;t have to o=
verride it.&quot;<br>
B says &quot;I have a function, you _have_ to override it.&quot; C says &qu=
ot;I&#39;ll inherit both<br>
of you&quot;. I disagree, STRONGLY, that C should just pick the impure func=
tion<br>
of A. There&#39;s no way to tell what the user meant, so, as unfortunate as=
 it may<br>
seem, the _right_ solution is to issue a diagnostic asking the user &quot;w=
hat?&quot;.<br>
<div><div><br>
--<br>
<br>
---<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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>


To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c2a89e79929904fe5c0551--

.


Author: Bjorn Reese <breese@mail1.stofanet.dk>
Date: Thu, 17 Jul 2014 11:44:39 +0200
Raw View
On 07/16/2014 10:49 PM, Hyman Rosen wrote:

>      struct A { virtual void f() { }  };
>      struct B { virtual void f() = 0; };
>      struct C : A, B { };

Although slightly off-topic for the current discussion, what if C wants
to implement both A::f and B::f?

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Thu, 17 Jul 2014 07:50:25 -0400
Raw View
--001a11337e421cc2fe04fe623f94
Content-Type: text/plain; charset=UTF-8

To answer your question...
struct C : A, B
{
    void f();
}

void C::f()
{
// implementation goes here
}
On Jul 17, 2014 5:45 AM, "Bjorn Reese" <breese@mail1.stofanet.dk> wrote:

> On 07/16/2014 10:49 PM, Hyman Rosen wrote:
>
>       struct A { virtual void f() { }  };
>>      struct B { virtual void f() = 0; };
>>      struct C : A, B { };
>>
>
> Although slightly off-topic for the current discussion, what if C wants
> to implement both A::f and B::f?
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-
> proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">To answer your question...<br>
struct C : A, B<br>
{<br>
=C2=A0=C2=A0=C2=A0 void f();<br>
}</p>
<p dir=3D"ltr">void C::f()<br>
{<br>
// implementation goes here<br>
}</p>
<div class=3D"gmail_quote">On Jul 17, 2014 5:45 AM, &quot;Bjorn Reese&quot;=
 &lt;<a href=3D"mailto:breese@mail1.stofanet.dk">breese@mail1.stofanet.dk</=
a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 07/16/2014 10:49 PM, Hyman Rosen wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
=C2=A0 =C2=A0 =C2=A0struct A { virtual void f() { } =C2=A0};<br>
=C2=A0 =C2=A0 =C2=A0struct B { virtual void f() =3D 0; };<br>
=C2=A0 =C2=A0 =C2=A0struct C : A, B { };<br>
</blockquote>
<br>
Although slightly off-topic for the current discussion, what if C wants<br>
to implement both A::f and B::f?<br>
<br>
-- <br>
<br>
--- You received this message because you are subscribed to a topic in the =
Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<u></u>isocpp.org/d/topic/std-<u></u>proposa=
ls/MUM6usZKPiw/<u></u>unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D"_blank">std-pr=
oposals+unsubscribe@<u></u>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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/<u></u>isocpp.=
org/group/std-<u></u>proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11337e421cc2fe04fe623f94--

.


Author: Bjorn Reese <breese@mail1.stofanet.dk>
Date: Thu, 17 Jul 2014 14:19:49 +0200
Raw View
Sorry about not being clear. I was assuming that although they have the
same name, they have different meanings, so C would need two different
implementations.

For instance, A and B may come from two different third-party packages,
and they just happen to use the same names.


On 07/17/2014 01:50 PM, Gino Vincenzini wrote:
> To answer your question...
> struct C : A, B
> {
>      void f();
> }
>
> void C::f()
> {
> // implementation goes here
> }
>
> On Jul 17, 2014 5:45 AM, "Bjorn Reese" <breese@mail1.stofanet.dk
> <mailto:breese@mail1.stofanet.dk>> wrote:
>
>     On 07/16/2014 10:49 PM, Hyman Rosen wrote:
>
>               struct A { virtual void f() { }  };
>               struct B { virtual void f() = 0; };
>               struct C : A, B { };
>
>
>     Although slightly off-topic for the current discussion, what if C wants
>     to implement both A::f and B::f?


--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Hyman Rosen <hyman.rosen@gmail.com>
Date: Thu, 17 Jul 2014 10:21:00 -0400
Raw View
--047d7b3a93e0ceb62404fe645a95
Content-Type: text/plain; charset=UTF-8

Interpose renaming classes:

    struct APrime : A { virtual void A_f() = 0; void f() { A_f(); } };
    struct BPrime : B { virtual void B_f() = 0; void f() { B_f(); } }
    struct C : APrime, BPrime { void A_f() { } void B_f() { } };

    C c;
    ((A&)c).f();  // calls C::A_f()
    ((B&)c).f();  // calls C::B_f();




On Thu, Jul 17, 2014 at 8:19 AM, Bjorn Reese <breese@mail1.stofanet.dk>
wrote:

> Sorry about not being clear. I was assuming that although they have the
> same name, they have different meanings, so C would need two different
> implementations.
>
> For instance, A and B may come from two different third-party packages,
> and they just happen to use the same names.
>
>
>
> On 07/17/2014 01:50 PM, Gino Vincenzini wrote:
>
>> To answer your question...
>> struct C : A, B
>> {
>>      void f();
>> }
>>
>> void C::f()
>> {
>> // implementation goes here
>> }
>>
>> On Jul 17, 2014 5:45 AM, "Bjorn Reese" <breese@mail1.stofanet.dk
>> <mailto:breese@mail1.stofanet.dk>> wrote:
>>
>>     On 07/16/2014 10:49 PM, Hyman Rosen wrote:
>>
>>               struct A { virtual void f() { }  };
>>               struct B { virtual void f() = 0; };
>>               struct C : A, B { };
>>
>>
>>     Although slightly off-topic for the current discussion, what if C
>> wants
>>     to implement both A::f and B::f?
>>
>
>
> --
>
> --- 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.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-
> proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--047d7b3a93e0ceb62404fe645a95
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Interpose renaming classes:<div><br></div><div><font face=
=3D"courier new, monospace">=C2=A0 =C2=A0 struct APrime : A { virtual void =
A_f() =3D 0; void f() { A_f(); } };</font></div><div><font face=3D"courier =
new, monospace">=C2=A0 =C2=A0 struct BPrime : B { virtual void B_f() =3D 0;=
 void f() { B_f(); } }</font></div>

<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 struct C : APrime,=
 BPrime { void A_f() { } void B_f() { } };</font></div><div><font face=3D"c=
ourier new, monospace"><br></font></div><div><font face=3D"courier new, mon=
ospace">=C2=A0 =C2=A0 C c;</font></div>

<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0 ((A&amp;)c).f(); =
=C2=A0// calls C::A_f()</font></div><div><font face=3D"courier new, monospa=
ce">=C2=A0 =C2=A0 ((B&amp;)c).f(); =C2=A0// calls C::B_f();<br></font><br><=
div><br></div></div></div><div class=3D"gmail_extra">

<br><br><div class=3D"gmail_quote">On Thu, Jul 17, 2014 at 8:19 AM, Bjorn R=
eese <span dir=3D"ltr">&lt;<a href=3D"mailto:breese@mail1.stofanet.dk" targ=
et=3D"_blank">breese@mail1.stofanet.dk</a>&gt;</span> wrote:<br><blockquote=
 class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc soli=
d;padding-left:1ex">

Sorry about not being clear. I was assuming that although they have the<br>
same name, they have different meanings, so C would need two different<br>
implementations.<br>
<br>
For instance, A and B may come from two different third-party packages,<br>
and they just happen to use the same names.<div class=3D""><br>
<br>
<br>
On 07/17/2014 01:50 PM, Gino Vincenzini wrote:<br>
</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div class=3D"">
To answer your question...<br>
struct C : A, B<br>
{<br>
=C2=A0 =C2=A0 =C2=A0void f();<br>
}<br>
<br>
void C::f()<br>
{<br>
// implementation goes here<br>
}<br>
<br>
On Jul 17, 2014 5:45 AM, &quot;Bjorn Reese&quot; &lt;<a href=3D"mailto:bree=
se@mail1.stofanet.dk" target=3D"_blank">breese@mail1.stofanet.dk</a><br></d=
iv><div class=3D"">
&lt;mailto:<a href=3D"mailto:breese@mail1.stofanet.dk" target=3D"_blank">br=
eese@mail1.stofanet.<u></u>dk</a>&gt;&gt; wrote:<br>
<br>
=C2=A0 =C2=A0 On 07/16/2014 10:49 PM, Hyman Rosen wrote:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct A { virtual void f(=
) { } =C2=A0};<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct B { virtual void f(=
) =3D 0; };<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct C : A, B { };<br>
<br>
<br>
=C2=A0 =C2=A0 Although slightly off-topic for the current discussion, what =
if C wants<br>
=C2=A0 =C2=A0 to implement both A::f and B::f?<br>
</div></blockquote>
<br>
<br>
-- <br><div class=3D"HOEnZb"><div class=3D"h5">
<br>
--- You received this message because you are subscribed to the Google Grou=
ps &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%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@<u></u>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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/<u></u>isocpp.=
org/group/std-<u></u>proposals/</a>.<br>
</div></div></blockquote></div><br></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--047d7b3a93e0ceb62404fe645a95--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Thu, 17 Jul 2014 10:25:32 -0400
Raw View
--001a1133d33ad0072f04fe6469ed
Content-Type: text/plain; charset=UTF-8

I understand the problem... basically B's f() method wasn't meant to
override A's virtual f()... but that would be really rare, you would need a
pure virtual f() and a non virtual f() with the exact same signature and
name from the two classes. It might make sense to make it so that this only
works with virtuals with no implementation can do this but pure virtuals
cannot. So...

struct A { virtual void f(); };
struct B { void f(); };
struct C : A, B {};

....would override C::f () with B::f () in C but...

struct A { virtual void f() = 0; }; // would not allow that and instead
force the subclass to manually reimplement f().
On Jul 17, 2014 8:19 AM, "Bjorn Reese" <breese@mail1.stofanet.dk> wrote:

> Sorry about not being clear. I was assuming that although they have the
> same name, they have different meanings, so C would need two different
> implementations.
>
> For instance, A and B may come from two different third-party packages,
> and they just happen to use the same names.
>
>
> On 07/17/2014 01:50 PM, Gino Vincenzini wrote:
>
>> To answer your question...
>> struct C : A, B
>> {
>>      void f();
>> }
>>
>> void C::f()
>> {
>> // implementation goes here
>> }
>>
>> On Jul 17, 2014 5:45 AM, "Bjorn Reese" <breese@mail1.stofanet.dk
>> <mailto:breese@mail1.stofanet.dk>> wrote:
>>
>>     On 07/16/2014 10:49 PM, Hyman Rosen wrote:
>>
>>               struct A { virtual void f() { }  };
>>               struct B { virtual void f() = 0; };
>>               struct C : A, B { };
>>
>>
>>     Although slightly off-topic for the current discussion, what if C
>> wants
>>     to implement both A::f and B::f?
>>
>
>
> --
>
> --- You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/
> isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-
> proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">I understand the problem... basically B&#39;s f() method was=
n&#39;t meant to override A&#39;s virtual f()... but that would be really r=
are, you would need a pure virtual f() and a non virtual f() with the exact=
 same signature and name from the two classes. It might make sense to make =
it so that this only works with virtuals with no implementation can do this=
 but pure virtuals cannot. So...</p>

<p dir=3D"ltr">struct A { virtual void f(); };<br>
struct B { void f(); };<br>
struct C : A, B {};</p>
<p dir=3D"ltr">...would override C::f () with B::f () in C but...</p>
<p dir=3D"ltr">struct A { virtual void f() =3D 0; }; // would not allow tha=
t and instead force the subclass to manually reimplement f().</p>
<div class=3D"gmail_quote">On Jul 17, 2014 8:19 AM, &quot;Bjorn Reese&quot;=
 &lt;<a href=3D"mailto:breese@mail1.stofanet.dk">breese@mail1.stofanet.dk</=
a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry about not being clear. I was assuming that although they have the<br>
same name, they have different meanings, so C would need two different<br>
implementations.<br>
<br>
For instance, A and B may come from two different third-party packages,<br>
and they just happen to use the same names.<br>
<br>
<br>
On 07/17/2014 01:50 PM, Gino Vincenzini wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
To answer your question...<br>
struct C : A, B<br>
{<br>
=C2=A0 =C2=A0 =C2=A0void f();<br>
}<br>
<br>
void C::f()<br>
{<br>
// implementation goes here<br>
}<br>
<br>
On Jul 17, 2014 5:45 AM, &quot;Bjorn Reese&quot; &lt;<a href=3D"mailto:bree=
se@mail1.stofanet.dk" target=3D"_blank">breese@mail1.stofanet.dk</a><br>
&lt;mailto:<a href=3D"mailto:breese@mail1.stofanet.dk" target=3D"_blank">br=
eese@mail1.stofanet.<u></u>dk</a>&gt;&gt; wrote:<br>
<br>
=C2=A0 =C2=A0 On 07/16/2014 10:49 PM, Hyman Rosen wrote:<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct A { virtual void f(=
) { } =C2=A0};<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct B { virtual void f(=
) =3D 0; };<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 struct C : A, B { };<br>
<br>
<br>
=C2=A0 =C2=A0 Although slightly off-topic for the current discussion, what =
if C wants<br>
=C2=A0 =C2=A0 to implement both A::f and B::f?<br>
</blockquote>
<br>
<br>
-- <br>
<br>
--- You received this message because you are subscribed to a topic in the =
Google Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/<u></u>isocpp.org/d/topic/std-<u></u>proposa=
ls/MUM6usZKPiw/<u></u>unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D"_blank">std-pr=
oposals+unsubscribe@<u></u>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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/<u></u>isocpp.=
org/group/std-<u></u>proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a1133d33ad0072f04fe6469ed--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 17 Jul 2014 08:23:52 -0700
Raw View
On Thursday 17 July 2014 14:19:49 Bjorn Reese wrote:
> Sorry about not being clear. I was assuming that although they have the
> same name, they have different meanings, so C would need two different
> implementations.

Assume that if they have the same signature, they have the same meaning.
Therefore, one single implementation is required.

You shouldn't do multiple inheritance if the case you're asking about is
possible.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Magnus Fromreide <magfr@lysator.liu.se>
Date: Thu, 17 Jul 2014 23:36:58 +0200
Raw View
On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:
> I understand the problem... basically B's f() method wasn't meant to
> override A's virtual f()... but that would be really rare, you would need a
> pure virtual f() and a non virtual f() with the exact same signature and
> name from the two classes. It might make sense to make it so that this only
> works with virtuals with no implementation can do this but pure virtuals
> cannot. So...
>
> struct A { virtual void f(); };
> struct B { void f(); };
> struct C : A, B {};
>
> ...would override C::f () with B::f () in C but...

Wouldn't that break the has_member[1] trait?

/MF

[1] https://groups.google.com/forum/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Thu, 17 Jul 2014 18:22:21 -0400
Raw View
--001a11337e4214fa7404fe6b131c
Content-Type: text/plain; charset=UTF-8

I dont follow. What do you mean?
On Jul 17, 2014 5:37 PM, "Magnus Fromreide" <magfr@lysator.liu.se> wrote:

> On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:
> > I understand the problem... basically B's f() method wasn't meant to
> > override A's virtual f()... but that would be really rare, you would
> need a
> > pure virtual f() and a non virtual f() with the exact same signature and
> > name from the two classes. It might make sense to make it so that this
> only
> > works with virtuals with no implementation can do this but pure virtuals
> > cannot. So...
> >
> > struct A { virtual void f(); };
> > struct B { void f(); };
> > struct C : A, B {};
> >
> > ...would override C::f () with B::f () in C but...
>
> Wouldn't that break the has_member[1] trait?
>
> /MF
>
> [1]
> https://groups.google.com/forum/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">I dont follow. What do you mean?</p>
<div class=3D"gmail_quote">On Jul 17, 2014 5:37 PM, &quot;Magnus Fromreide&=
quot; &lt;<a href=3D"mailto:magfr@lysator.liu.se">magfr@lysator.liu.se</a>&=
gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:<br>
&gt; I understand the problem... basically B&#39;s f() method wasn&#39;t me=
ant to<br>
&gt; override A&#39;s virtual f()... but that would be really rare, you wou=
ld need a<br>
&gt; pure virtual f() and a non virtual f() with the exact same signature a=
nd<br>
&gt; name from the two classes. It might make sense to make it so that this=
 only<br>
&gt; works with virtuals with no implementation can do this but pure virtua=
ls<br>
&gt; cannot. So...<br>
&gt;<br>
&gt; struct A { virtual void f(); };<br>
&gt; struct B { void f(); };<br>
&gt; struct C : A, B {};<br>
&gt;<br>
&gt; ...would override C::f () with B::f () in C but...<br>
<br>
Wouldn&#39;t that break the has_member[1] trait?<br>
<br>
/MF<br>
<br>
[1] <a href=3D"https://groups.google.com/forum/#!msg/comp.lang.c++.moderate=
d/T3x6lvmvvkQ/mfY5VTDJ--UJ" target=3D"_blank">https://groups.google.com/for=
um/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ</a><br>
<br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-proposals+unsubscrib=
e@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11337e4214fa7404fe6b131c--

.


Author: Magnus Fromreide <magfr@lysator.liu.se>
Date: Fri, 18 Jul 2014 05:54:02 +0200
Raw View
On Thu, Jul 17, 2014 at 06:22:21PM -0400, Gino Vincenzini wrote:
> I dont follow. What do you mean?

They implements a  metafunction, is_call_possible, that checks if a class
contains a callable named f. In order to do that they use the possible
ambiguity of C::f to detect the existance of A::f here A is the unknown
class they wants to test.

/MF

If your change makes
> On Jul 17, 2014 5:37 PM, "Magnus Fromreide" <magfr@lysator.liu.se> wrote:
>
> > On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:
> > > I understand the problem... basically B's f() method wasn't meant to
> > > override A's virtual f()... but that would be really rare, you would
> > need a
> > > pure virtual f() and a non virtual f() with the exact same signature and
> > > name from the two classes. It might make sense to make it so that this
> > only
> > > works with virtuals with no implementation can do this but pure virtuals
> > > cannot. So...
> > >
> > > struct A { virtual void f(); };
> > > struct B { void f(); };
> > > struct C : A, B {};
> > >
> > > ...would override C::f () with B::f () in C but...
> >
> > Wouldn't that break the has_member[1] trait?
> >
> > /MF
> >
> > [1]
> > https://groups.google.com/forum/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ
> >
> > --
> >
> > ---
> > You received this message because you are subscribed to a topic in the
> > Google Groups "ISO C++ Standard - Future Proposals" group.
> > To unsubscribe from this topic, visit
> > https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> > .
> > To unsubscribe from this group and all its topics, send an email to
> > std-proposals+unsubscribe@isocpp.org.
> > To post to this group, send email to std-proposals@isocpp.org.
> > Visit this group at
> > http://groups.google.com/a/isocpp.org/group/std-proposals/.
> >
>
> --
>
> ---
> 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.
> Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Fri, 18 Jul 2014 07:47:38 -0400
Raw View
--001a11c2a89efab69e04fe7652ac
Content-Type: text/plain; charset=UTF-8

Got me. Im not familiar with that.
On Jul 17, 2014 11:54 PM, "Magnus Fromreide" <magfr@lysator.liu.se> wrote:

> On Thu, Jul 17, 2014 at 06:22:21PM -0400, Gino Vincenzini wrote:
> > I dont follow. What do you mean?
>
> They implements a  metafunction, is_call_possible, that checks if a class
> contains a callable named f. In order to do that they use the possible
> ambiguity of C::f to detect the existance of A::f here A is the unknown
> class they wants to test.
>
> /MF
>
> If your change makes
> > On Jul 17, 2014 5:37 PM, "Magnus Fromreide" <magfr@lysator.liu.se>
> wrote:
> >
> > > On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:
> > > > I understand the problem... basically B's f() method wasn't meant to
> > > > override A's virtual f()... but that would be really rare, you would
> > > need a
> > > > pure virtual f() and a non virtual f() with the exact same signature
> and
> > > > name from the two classes. It might make sense to make it so that
> this
> > > only
> > > > works with virtuals with no implementation can do this but pure
> virtuals
> > > > cannot. So...
> > > >
> > > > struct A { virtual void f(); };
> > > > struct B { void f(); };
> > > > struct C : A, B {};
> > > >
> > > > ...would override C::f () with B::f () in C but...
> > >
> > > Wouldn't that break the has_member[1] trait?
> > >
> > > /MF
> > >
> > > [1]
> > >
> https://groups.google.com/forum/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ
> > >
> > > --
> > >
> > > ---
> > > You received this message because you are subscribed to a topic in the
> > > Google Groups "ISO C++ Standard - Future Proposals" group.
> > > To unsubscribe from this topic, visit
> > >
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> > > .
> > > To unsubscribe from this group and all its topics, send an email to
> > > std-proposals+unsubscribe@isocpp.org.
> > > To post to this group, send email to std-proposals@isocpp.org.
> > > Visit this group at
> > > http://groups.google.com/a/isocpp.org/group/std-proposals/.
> > >
> >
> > --
> >
> > ---
> > 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.
> > Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">Got me. Im not familiar with that.</p>
<div class=3D"gmail_quote">On Jul 17, 2014 11:54 PM, &quot;Magnus Fromreide=
&quot; &lt;<a href=3D"mailto:magfr@lysator.liu.se">magfr@lysator.liu.se</a>=
&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Thu, Jul 17, 2014 at 06:22:21PM -0400, Gino Vincenzini wrote:<br>
&gt; I dont follow. What do you mean?<br>
<br>
They implements a =C2=A0metafunction, is_call_possible, that checks if a cl=
ass<br>
contains a callable named f. In order to do that they use the possible<br>
ambiguity of C::f to detect the existance of A::f here A is the unknown<br>
class they wants to test.<br>
<br>
/MF<br>
<br>
If your change makes<br>
&gt; On Jul 17, 2014 5:37 PM, &quot;Magnus Fromreide&quot; &lt;<a href=3D"m=
ailto:magfr@lysator.liu.se">magfr@lysator.liu.se</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On Thu, Jul 17, 2014 at 10:25:32AM -0400, Gino Vincenzini wrote:<=
br>
&gt; &gt; &gt; I understand the problem... basically B&#39;s f() method was=
n&#39;t meant to<br>
&gt; &gt; &gt; override A&#39;s virtual f()... but that would be really rar=
e, you would<br>
&gt; &gt; need a<br>
&gt; &gt; &gt; pure virtual f() and a non virtual f() with the exact same s=
ignature and<br>
&gt; &gt; &gt; name from the two classes. It might make sense to make it so=
 that this<br>
&gt; &gt; only<br>
&gt; &gt; &gt; works with virtuals with no implementation can do this but p=
ure virtuals<br>
&gt; &gt; &gt; cannot. So...<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; struct A { virtual void f(); };<br>
&gt; &gt; &gt; struct B { void f(); };<br>
&gt; &gt; &gt; struct C : A, B {};<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; ...would override C::f () with B::f () in C but...<br>
&gt; &gt;<br>
&gt; &gt; Wouldn&#39;t that break the has_member[1] trait?<br>
&gt; &gt;<br>
&gt; &gt; /MF<br>
&gt; &gt;<br>
&gt; &gt; [1]<br>
&gt; &gt; <a href=3D"https://groups.google.com/forum/#!msg/comp.lang.c++.mo=
derated/T3x6lvmvvkQ/mfY5VTDJ--UJ" target=3D"_blank">https://groups.google.c=
om/forum/#!msg/comp.lang.c++.moderated/T3x6lvmvvkQ/mfY5VTDJ--UJ</a><br>
&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; ---<br>
&gt; &gt; You received this message because you are subscribed to a topic i=
n the<br>
&gt; &gt; Google Groups &quot;ISO C++ Standard - Future Proposals&quot; gro=
up.<br>
&gt; &gt; To unsubscribe from this topic, visit<br>
&gt; &gt; <a href=3D"https://groups.google.com/a/isocpp.org/d/topic/std-pro=
posals/MUM6usZKPiw/unsubscribe" target=3D"_blank">https://groups.google.com=
/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe</a><br>
&gt; &gt; .<br>
&gt; &gt; To unsubscribe from this group and all its topics, send an email =
to<br>
&gt; &gt; <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-pro=
posals+unsubscribe@isocpp.org</a>.<br>
&gt; &gt; To post to this group, send email to <a href=3D"mailto:std-propos=
als@isocpp.org">std-proposals@isocpp.org</a>.<br>
&gt; &gt; Visit this group at<br>
&gt; &gt; <a href=3D"http://groups.google.com/a/isocpp.org/group/std-propos=
als/" target=3D"_blank">http://groups.google.com/a/isocpp.org/group/std-pro=
posals/</a>.<br>
&gt; &gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; ---<br>
&gt; You received this message because you are subscribed to the Google Gro=
ups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
&gt; To unsubscribe from this group and stop receiving emails from it, send=
 an email to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-=
proposals+unsubscribe@isocpp.org</a>.<br>
&gt; To post to this group, send email to <a href=3D"mailto:std-proposals@i=
socpp.org">std-proposals@isocpp.org</a>.<br>
&gt; Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/g=
roup/std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.or=
g/group/std-proposals/</a>.<br>
<br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org">std-proposals+unsubscrib=
e@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c2a89efab69e04fe7652ac--

.


Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Sun, 20 Jul 2014 22:28:37 -0700 (PDT)
Raw View
------=_Part_260_417522158.1405920517268
Content-Type: text/plain; charset=UTF-8

As I read it, this is basically proposing a limited form of mixins. It lets
you create an interface A and an implemention (or a partial implementation)
B.

I like the conservative, minimalistic approach taken here.

Though we have to be careful because this is already well-defined:

  struct A { virtual void f() = 0; };
  struct B { void f() {} };

  // today, C is still abstract since A::f is still pure virtual
  struct C : A, B {
    using B::f;
  };

there's almost certainly code that relies on that so there'd need to be
some minor variation in new syntax just to avoid breaking behavior, e.g.
something like

   struct C : A, B override virtual { ... };
   // or
   struct C : A, B {
     using virtual B::*; // do it for any member in B
     using virtual B::f; // just for member 'f'
   };

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_260_417522158.1405920517268
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">As I read it, this is basically proposing a limited form o=
f mixins. It lets you create an interface A and an implemention (or a parti=
al implementation) B.<div><br></div><div>I like the conservative, minimalis=
tic approach taken here.</div><div><br></div><div>Though we have to be care=
ful because this is already well-defined:</div><div><br></div><div>&nbsp; s=
truct A { virtual void f() =3D 0; };</div><div>&nbsp; struct B { void f() {=
} };</div><div><br></div><div>&nbsp; // today, C is still abstract since A:=
:f is still pure virtual</div><div>&nbsp; struct C : A, B {</div><div>&nbsp=
; &nbsp; using B::f;</div><div>&nbsp; };</div><div><br></div><div>there's a=
lmost certainly code that relies on that so there'd need to be some minor v=
ariation in new syntax just to avoid breaking behavior, e.g. something like=
</div><div><div><br></div><div>&nbsp; &nbsp;struct C : A, B override virtua=
l { ... };<br></div><div>&nbsp; &nbsp;// or<br></div><div>&nbsp; &nbsp;stru=
ct C : A, B {<br></div><div>&nbsp; &nbsp; &nbsp;using virtual B::*; // do i=
t for any member in B<br></div><div>&nbsp; &nbsp; &nbsp;using virtual B::f;=
 // just for member 'f'</div><div>&nbsp; &nbsp;};</div></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_260_417522158.1405920517268--

.


Author: Gino Vincenzini <openmysourcecode@gmail.com>
Date: Mon, 21 Jul 2014 05:44:45 -0400
Raw View
--001a11c2a89e0d461804feb0f58b
Content-Type: text/plain; charset=UTF-8

Oooh! That looks like it would work nicely. Very elegantly simple syntax
too.
On Jul 21, 2014 1:28 AM, "Sean Middleditch" <sean.middleditch@gmail.com>
wrote:

> As I read it, this is basically proposing a limited form of mixins. It
> lets you create an interface A and an implemention (or a partial
> implementation) B.
>
> I like the conservative, minimalistic approach taken here.
>
> Though we have to be careful because this is already well-defined:
>
>   struct A { virtual void f() = 0; };
>   struct B { void f() {} };
>
>   // today, C is still abstract since A::f is still pure virtual
>   struct C : A, B {
>     using B::f;
>   };
>
> there's almost certainly code that relies on that so there'd need to be
> some minor variation in new syntax just to avoid breaking behavior, e.g.
> something like
>
>    struct C : A, B override virtual { ... };
>    // or
>    struct C : A, B {
>      using virtual B::*; // do it for any member in B
>      using virtual B::f; // just for member 'f'
>    };
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<p dir=3D"ltr">Oooh! That looks like it would work nicely. Very elegantly s=
imple syntax too. </p>
<div class=3D"gmail_quote">On Jul 21, 2014 1:28 AM, &quot;Sean Middleditch&=
quot; &lt;<a href=3D"mailto:sean.middleditch@gmail.com">sean.middleditch@gm=
ail.com</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_q=
uote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1e=
x">
<div dir=3D"ltr">As I read it, this is basically proposing a limited form o=
f mixins. It lets you create an interface A and an implemention (or a parti=
al implementation) B.<div><br></div><div>I like the conservative, minimalis=
tic approach taken here.</div>
<div><br></div><div>Though we have to be careful because this is already we=
ll-defined:</div><div><br></div><div>=C2=A0 struct A { virtual void f() =3D=
 0; };</div><div>=C2=A0 struct B { void f() {} };</div><div><br></div><div>=
=C2=A0 // today, C is still abstract since A::f is still pure virtual</div>
<div>=C2=A0 struct C : A, B {</div><div>=C2=A0 =C2=A0 using B::f;</div><div=
>=C2=A0 };</div><div><br></div><div>there&#39;s almost certainly code that =
relies on that so there&#39;d need to be some minor variation in new syntax=
 just to avoid breaking behavior, e.g. something like</div>
<div><div><br></div><div>=C2=A0 =C2=A0struct C : A, B override virtual { ..=
.. };<br></div><div>=C2=A0 =C2=A0// or<br></div><div>=C2=A0 =C2=A0struct C :=
 A, B {<br></div><div>=C2=A0 =C2=A0 =C2=A0using virtual B::*; // do it for =
any member in B<br></div><div>=C2=A0 =C2=A0 =C2=A0using virtual B::f; // ju=
st for member &#39;f&#39;</div>
<div>=C2=A0 =C2=A0};</div></div></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups &quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/MUM6usZKPiw=
/unsubscribe</a>.<br>

To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_blank">std-prop=
osals+unsubscribe@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>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c2a89e0d461804feb0f58b--

.


Author: Tony V E <tvaneerd@gmail.com>
Date: Thu, 24 Jul 2014 14:11:26 -0400
Raw View
--001a11c34cc2a24c0c04fef462ff
Content-Type: text/plain; charset=UTF-8

On Thu, Jul 17, 2014 at 8:19 AM, Bjorn Reese <breese@mail1.stofanet.dk>
wrote:

> Sorry about not being clear. I was assuming that although they have the
> same name, they have different meanings, so C would need two different
> implementations.
>
> For instance, A and B may come from two different third-party packages,
> and they just happen to use the same names.
>
>
>
I've run into this case, and wished there was an easier solution to it.
ie, Microsoft's compiler use to accept this use of "Base::" below:

struct Base
{
    virtual void f();
};

struct Derived : Base
{
    virtual void Base::f() { };   // note use of Base:: here
};

That was an error on other compilers, but MS accepted it (for better or
worse).

I always thought that the above syntax would have been a better way to say
"override" (and without a keyword), and it could also solve the name
collision problem:



struct Base1
{
    virtual void f();
};


struct Base2
{
    virtual void f();
};


struct Derived : Base1, Base2
{
    virtual void Base1::f() { /* called as Base1 */ }
    virtual void Base2::f() { /* called as Base2 */ }
};

--

---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

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

<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Thu, Jul 17, 2014 at 8:19 AM, Bjorn Reese <span dir=3D"ltr">&lt;=
<a href=3D"mailto:breese@mail1.stofanet.dk" target=3D"_blank">breese@mail1.=
stofanet.dk</a>&gt;</span> 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">Sorry about not being cle=
ar. I was assuming that although they have the<br>
same name, they have different meanings, so C would need two different<br>
implementations.<br>
<br>
For instance, A and B may come from two different third-party packages,<br>
and they just happen to use the same names.<div class=3D""><br>
<br></div></blockquote><div><br></div></div>I&#39;ve run into this case, an=
d wished there was an easier solution to it.=C2=A0 ie, Microsoft&#39;s comp=
iler use to accept this use of &quot;Base::&quot; below:<br><br></div><div =
class=3D"gmail_extra">
struct Base<br>{<br></div><div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 vir=
tual void f();<br>};<br><br></div><div class=3D"gmail_extra">struct Derived=
 : Base<br>{<br></div><div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 virtual=
 void Base::f() { };=C2=A0=C2=A0 // note use of Base:: here<br>
};<br><br></div><div class=3D"gmail_extra">That was an error on other compi=
lers, but MS accepted it (for better or worse).<br><br>I always thought tha=
t the above syntax would have been a better way to say &quot;override&quot;=
 (and without a keyword), and it could also solve the name collision proble=
m:<br>
<br><br></div><div class=3D"gmail_extra"><br><div class=3D"gmail_extra">str=
uct Base1<br>{<br></div>=C2=A0=C2=A0=C2=A0 virtual void f();<br>};<br><br><=
br><div class=3D"gmail_extra">struct Base2<br>{<br></div>=C2=A0=C2=A0=C2=A0=
 virtual void f();<br>};<br><br>
<br><div class=3D"gmail_extra">struct Derived : Base1, Base2<br>{<br></div>=
=C2=A0=C2=A0=C2=A0 virtual void Base1::f() { /* called as Base1 */ }<br></d=
iv><div class=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 virtual void Base2::f() { =
/* called as Base2 */ }<br></div>
<div class=3D"gmail_extra">};<br><br><br><br></div></div>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--001a11c34cc2a24c0c04fef462ff--

.