Topic: Limited inheritance for classes
Author: Dmitry Leontiev <dm.leontiev7@gmail.com>
Date: Wed, 20 Nov 2013 05:50:08 -0800 (PST)
Raw View
------=_Part_47_9953908.1384955408323
Content-Type: text/plain; charset=ISO-8859-1
Hello
In my opinion, there must be a way tell compiler to not to expose parent
class to child classes. Consider the following example:
class EventHandler {
protected:
virtual void function()=0;
};
class EventSource {
void RegisterEventHandler(EventHandler * ev);
};
//resides in some popular shared library
class A : private EventHandler {
A(){
source1.RegisterEventHandler(this);
}
private:
void function(){printf("a");}
};
//imlemented by a developer who is unaware of A internals
class B : public A, private EventHandler {
B(){
source2.RegisterEventHandler(this);
}
private:
void function(){printf("b");}
};
In this example, classes A and B register event handlers for different
event sources upon creation.
However, class B steals events from A by overriding function "function" in
both EventHandlers.
There must be a convinient way for "some popular shared library" developer
to prevent overriding from child classes.
for example
class A : private static EventHandler { ... }
Regards, Dmitry
--
---
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_47_9953908.1384955408323
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hello</div><div> </div><div>In my opinion, there=
must be a way tell compiler to not to expose parent class t=
o child classes. Consider the following example:</div><div> </div=
><div>class EventHandler { </div><div>protected:<br>  =
; virtual void function()=3D0;<br>};<br>class EventSource {<br> &nbs=
p; void RegisterEventHandler(EventHandler * ev);<br>};<br> </di=
v><div>//resides in some popular shared library<br>class A : private E=
ventHandler {<br> A(){<br>  =
; source1.RegisterEventHandler(this);<br> }</div>=
<div>private:<br> void function(){printf("a")=
;}<br>};</div><div>//imlemented by a developer who is unaware of A int=
ernals<br>class B : public A, private EventHandler {<br> =
B(){<br> source2.RegisterEventHa=
ndler(this);<br> }</div><div>private:<br> &n=
bsp; void function(){printf("b");}<br>};</div><div> </div>=
<div>In this example, classes A and B register event handlers for different=
event sources upon creation. </div><div>However, class B steals events fro=
m A by overriding function "function" in both EventHandlers. </div><di=
v>There must be a convinient way for "some popular shared library" dev=
eloper to prevent overriding from child classes. </div><div>=
</div><div>for example</div><div>class A : private static EventHandle=
r { ... }</div><div> </div><div>Regards, Dmitry</div><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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_47_9953908.1384955408323--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 20 Nov 2013 15:54:05 +0200
Raw View
On 20 November 2013 15:50, Dmitry Leontiev <dm.leontiev7@gmail.com> wrote:
> Hello
>
> In my opinion, there must be a way tell compiler to not to expose parent
> class to child classes. Consider the following example:
>
> class EventHandler {
> protected:
> virtual void function()=0;
> };
> class EventSource {
> void RegisterEventHandler(EventHandler * ev);
> };
> //resides in some popular shared library
> class A : private EventHandler {
> A(){
> source1.RegisterEventHandler(this);
> }
> private:
> void function(){printf("a");}
> };
> //imlemented by a developer who is unaware of A internals
> class B : public A, private EventHandler {
> B(){
> source2.RegisterEventHandler(this);
> }
> private:
> void function(){printf("b");}
> };
>
> In this example, classes A and B register event handlers for different event
> sources upon creation.
> However, class B steals events from A by overriding function "function" in
> both EventHandlers.
> There must be a convinient way for "some popular shared library" developer
> to prevent overriding from child classes.
>
> for example
> class A : private static EventHandler { ... }
I can imagine at least two ways to do this with existing c++:
1) mark the overrides final in A
2) don't inherit EventHandler in A, inherit it in a subobject of A and
delegate the
overridden functions to non-virtual private functions of A
The latter is not as convenient as it could be without programmable reflection
dispatch, but it's not hugely inconvenient either. The former is rather easy.
--
---
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: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JvQtdC+0L3RgtGM0LXQsg==?= <dm.leontiev7@gmail.com>
Date: Wed, 20 Nov 2013 18:32:40 +0400
Raw View
--bcaec51d25524a36f404eb9ca7f1
Content-Type: text/plain; charset=ISO-8859-1
Final keyword is definitely not a solution here, because all I want is to
tell the compiler: just don't clobber this part of VTable.
That's an easy task for compiler.
2013/11/20 Ville Voutilainen <ville.voutilainen@gmail.com>
> On 20 November 2013 15:50, Dmitry Leontiev <dm.leontiev7@gmail.com> wrote:
> > Hello
> >
> > In my opinion, there must be a way tell compiler to not to expose parent
> > class to child classes. Consider the following example:
> >
> > class EventHandler {
> > protected:
> > virtual void function()=0;
> > };
> > class EventSource {
> > void RegisterEventHandler(EventHandler * ev);
> > };
> > //resides in some popular shared library
> > class A : private EventHandler {
> > A(){
> > source1.RegisterEventHandler(this);
> > }
> > private:
> > void function(){printf("a");}
> > };
> > //imlemented by a developer who is unaware of A internals
> > class B : public A, private EventHandler {
> > B(){
> > source2.RegisterEventHandler(this);
> > }
> > private:
> > void function(){printf("b");}
> > };
> >
> > In this example, classes A and B register event handlers for different
> event
> > sources upon creation.
> > However, class B steals events from A by overriding function "function"
> in
> > both EventHandlers.
> > There must be a convinient way for "some popular shared library"
> developer
> > to prevent overriding from child classes.
> >
> > for example
> > class A : private static EventHandler { ... }
>
>
> I can imagine at least two ways to do this with existing c++:
> 1) mark the overrides final in A
> 2) don't inherit EventHandler in A, inherit it in a subobject of A and
> delegate the
> overridden functions to non-virtual private functions of A
>
> The latter is not as convenient as it could be without programmable
> reflection
> dispatch, but it's not hugely inconvenient either. The former is rather
> easy.
>
> --
>
> ---
> 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/XHPXdG01rBY/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/.
--bcaec51d25524a36f404eb9ca7f1
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Final keyword is definitely not a solution here, beca=
use=A0all I want is=A0 to tell the compiler: just don't clobber this pa=
rt of VTable. </div><div>=A0</div><div>That's an easy task for compiler=
..</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11=
/20 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutila=
inen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
<div class=3D"HOEnZb"><div class=3D"h5">On 20 November 2013 15:50, Dmitry L=
eontiev <<a href=3D"mailto:dm.leontiev7@gmail.com">dm.leontiev7@gmail.co=
m</a>> wrote:<br>
> Hello<br>
><br>
> In my opinion, there must be a way tell compiler to not to expose pare=
nt<br>
> class to child classes. Consider the following example:<br>
><br>
> class EventHandler {<br>
> protected:<br>
> =A0 =A0 =A0 virtual void function()=3D0;<br>
> };<br>
> class EventSource {<br>
> =A0 =A0 void RegisterEventHandler(EventHandler * ev);<br>
> };<br>
> //resides in some popular shared library<br>
> class A : private EventHandler {<br>
> =A0 =A0 A(){<br>
> =A0 =A0 =A0 =A0source1.RegisterEventHandler(this);<br>
> =A0 =A0 }<br>
> private:<br>
> =A0 =A0 =A0 void function(){printf("a");}<br>
> };<br>
> //imlemented by a developer who is unaware of A internals<br>
> class B : public A, private EventHandler {<br>
> =A0 =A0 B(){<br>
> =A0 =A0 =A0 =A0source2.RegisterEventHandler(this);<br>
> =A0 =A0 }<br>
> private:<br>
> =A0 =A0 =A0 void function(){printf("b");}<br>
> };<br>
><br>
> In this example, classes A and B register event handlers for different=
event<br>
> sources upon creation.<br>
> However, class B steals events from A by overriding function "fun=
ction" in<br>
> both EventHandlers.<br>
> There must be a convinient way for "some popular shared library&q=
uot; developer<br>
> to prevent overriding from child classes.<br>
><br>
> for example<br>
> class A : private static EventHandler { ... }<br>
<br>
<br>
</div></div>I can imagine at least two ways to do this with existing c++:<b=
r>
1) mark the overrides final in A<br>
2) don't inherit EventHandler in A, inherit it in a subobject of A and<=
br>
delegate the<br>
overridden functions to non-virtual private functions of A<br>
<br>
The latter is not as convenient as it could be without programmable reflect=
ion<br>
dispatch, but it's not hugely inconvenient either. The former is rather=
easy.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY=
/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>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--bcaec51d25524a36f404eb9ca7f1--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 20 Nov 2013 16:34:06 +0200
Raw View
On 20 November 2013 16:32, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7 <=
dm.leontiev7@gmail.com> wrote:
> Final keyword is definitely not a solution here, because all I want is t=
o
> tell the compiler: just don't clobber this part of VTable.
>
> That's an easy task for compiler.
It's not a solution because.. why?
--=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: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JvQtdC+0L3RgtGM0LXQsg==?= <dm.leontiev7@gmail.com>
Date: Wed, 20 Nov 2013 18:38:33 +0400
Raw View
--089e0115ef9c4be20604eb9cbccd
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
because I'll get an error on line:
class B : public A, private Handler {
void function();//ERROR: function is final
};
final does not protect VTable
2013/11/20 Ville Voutilainen <ville.voutilainen@gmail.com>
> On 20 November 2013 16:32, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7=
<dm.leontiev7@gmail.com>
> wrote:
> > Final keyword is definitely not a solution here, because all I want is
> to
> > tell the compiler: just don't clobber this part of VTable.
> >
> > That's an easy task for compiler.
>
>
> It's not a solution because.. why?
>
> --
>
> ---
> 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/XHPXdG01rBY/=
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/.
--089e0115ef9c4be20604eb9cbccd
Content-Type: text/html; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>because I'll get an error on line:</div><div>=9A<=
/div><div>class B : public A, private Handler {</div><div>=9A=9A=9A void fu=
nction();//ERROR: function is final</div><div>};</div><div>=9A</div><div>fi=
nal does not protect VTable</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11=
/20 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutila=
inen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
<div class=3D"im">On 20 November 2013 16:32, =E4=CD=C9=D4=D2=C9=CA =EC=C5=
=CF=CE=D4=D8=C5=D7 <<a href=3D"mailto:dm.leontiev7@gmail.com">dm.leontie=
v7@gmail.com</a>> wrote:<br>
> Final keyword is definitely not a solution here, because all I want is=
=9Ato<br>
> tell the compiler: just don't clobber this part of VTable.<br>
><br>
> That's an easy task for compiler.<br>
<br>
<br>
</div>It's not a solution because.. why?<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY=
/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>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--089e0115ef9c4be20604eb9cbccd--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 20 Nov 2013 16:49:49 +0200
Raw View
On 20 November 2013 16:38, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7 <=
dm.leontiev7@gmail.com> wrote:
> because I'll get an error on line:
>
> class B : public A, private Handler {
> void function();//ERROR: function is final
> };
>
> final does not protect VTable
You didn't want B to be able to override 'function', final gave you exactly
that, and now you don't want exactly that? If B is still able to
override 'function',
what is that supposed to mean, and how does that prevent the problem
you described?
--=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: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JvQtdC+0L3RgtGM0LXQsg==?= <dm.leontiev7@gmail.com>
Date: Wed, 20 Nov 2013 18:52:49 +0400
Raw View
--089e01634aa65a895904eb9cef41
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I want B to override function. And I want A to override function. I want B
to not no override function A already overrided.
The problem is B overrides function() in _both_ parent classes. I want it
to override only one function() in one parent.
2013/11/20 Ville Voutilainen <ville.voutilainen@gmail.com>
> On 20 November 2013 16:38, =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9 =D0=
=9B=D0=B5=D0=BE=D0=BD=D1=82=D1=8C=D0=B5=D0=B2 <dm.leontiev7@gmail.com>
> wrote:
> > because I'll get an error on line:
> >
> > class B : public A, private Handler {
> > void function();//ERROR: function is final
> > };
> >
> > final does not protect VTable
>
>
> You didn't want B to be able to override 'function', final gave you exact=
ly
> that, and now you don't want exactly that? If B is still able to
> override 'function',
> what is that supposed to mean, and how does that prevent the problem
> you described?
>
> --
>
> ---
> 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/XHPXdG01rBY/=
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/.
--089e01634aa65a895904eb9cef41
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I want B to override function. And I want A to overri=
de function. I want B to not no override function A already overrided.</div=
><div>=C2=A0</div><div>The problem is B overrides function() in _both_ pare=
nt classes. I want it to override only one function() in one parent.</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11=
/20 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutila=
inen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
<div class=3D"im">On 20 November 2013 16:38, =D0=94=D0=BC=D0=B8=D1=82=D1=80=
=D0=B8=D0=B9 =D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D1=8C=D0=B5=D0=B2 <<a href=
=3D"mailto:dm.leontiev7@gmail.com">dm.leontiev7@gmail.com</a>> wrote:<br=
>
> because I'll get an error on line:<br>
><br>
> class B : public A, private Handler {<br>
> =C2=A0 =C2=A0 void function();//ERROR: function is final<br>
> };<br>
><br>
> final does not protect VTable<br>
<br>
<br>
</div>You didn't want B to be able to override 'function', fina=
l gave you exactly<br>
that, and now you don't want exactly that? If B is still able to<br>
override 'function',<br>
what is that supposed to mean, and how does that prevent the problem<br>
you described?<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY=
/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>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--089e01634aa65a895904eb9cef41--
.
Author: Jean-Marc Bourguet <jm.bourguet@gmail.com>
Date: Wed, 20 Nov 2013 07:02:24 -0800 (PST)
Raw View
------=_Part_3841_26462320.1384959744425
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Le mercredi 20 novembre 2013 14:50:08 UTC+1, Dmitry Leontiev a =E9crit :
>
> Hello
> =20
> In my opinion, there must be a way tell compiler to not to expose parent=
=20
> class to child classes. Consider the following example:
> =20
> class EventHandler {=20
> protected:
> virtual void function()=3D0;
> };
> class EventSource {
> void RegisterEventHandler(EventHandler * ev);
> };
> //resides in some popular shared library
> class A : private EventHandler {
> A(){
> source1.RegisterEventHandler(this);
> }
> private:
> void function(){printf("a");}
> };
> //imlemented by a developer who is unaware of A internals
> class B : public A, private EventHandler {
> B(){
> source2.RegisterEventHandler(this);
> }
> private:
> void function(){printf("b");}
> };
> =20
> In this example, classes A and B register event handlers for different=20
> event sources upon creation.=20
> However, class B steals events from A by overriding function "function" i=
n=20
> both EventHandlers.=20
> There must be a convinient way for "some popular shared library" develope=
r=20
> to prevent overriding from child classes.=20
> =20
> for example
> class A : private static EventHandler { ... }
> =20
> Regards, Dmitry
>
That shouldn't compile (there is an ambiguity at registration of B to=20
source2). And to solve that you'll have to introduce a new class
between B and EventHandler where you can put your handler.=20
Yours,
--=20
Jean-Marc
--=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/.
------=_Part_3841_26462320.1384959744425
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Le mercredi 20 novembre 2013 14:50:08 UTC+1, Dmitry Leonti=
ev a =E9crit :<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><div>Hello</div><div> </div><div>In my opinion, there must be a =
way tell compiler to not to expose parent class to chil=
d classes. Consider the following example:</div><div> </div><div>class=
EventHandler { </div><div>protected:<br> vir=
tual void function()=3D0;<br>};<br>class EventSource {<br> &nb=
sp; void RegisterEventHandler(<wbr>EventHandler * ev);<br>};<br> </div><div=
>//resides in some popular shared library<br>class A : private EventHa=
ndler {<br> A(){<br>  =
; source1.RegisterEventHandler(<wbr>this);<br> }</div><=
div>private:<br> void function(){printf("a");=
}<br>};</div><div>//imlemented by a developer who is unaware of A inte=
rnals<br>class B : public A, private EventHandler {<br> &=
nbsp; B(){<br> source2.RegisterEventHan=
dler(<wbr>this);<br> }</div><div>private:<br> &nbs=
p; void function(){printf("b");}<br>};</div><div> </=
div><div>In this example, classes A and B register event handlers for diffe=
rent event sources upon creation. </div><div>However, class B steals events=
from A by overriding function "function" in both EventHandlers. </div=
><div>There must be a convinient way for "some popular shared library"=
developer to prevent overriding from child classes. </div><=
div> </div><div>for example</div><div>class A : private static EventHa=
ndler { ... }</div><div> </div><div>Regards, Dmitry</div></div></block=
quote><div><br></div><div>That shouldn't compile (there is an ambiguity at =
registration of B to source2). And to solve that you'll have to intro=
duce a new class</div><div>between B and EventHandler where you can put you=
r handler. </div><div><br></div><div>Yours,</div><div>-- </div><d=
iv>Jean-Marc</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_3841_26462320.1384959744425--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 20 Nov 2013 17:02:30 +0200
Raw View
On 20 November 2013 16:52, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7 <=
dm.leontiev7@gmail.com> wrote:
> I want B to override function. And I want A to override function. I want =
B
> to not no override function A already overrided.
>
> The problem is B overrides function() in _both_ parent classes. I want it=
to
> override only one function() in one parent.
So.. when B converts itself to a A* or A&, you want A::function to be used,=
and
when B converts itself to an EventHandler* or EventHandler&, you want
B::function
to be used?
I fail to see how such things are common enough to make a language change
to support it.
--=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: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 22 Nov 2013 14:50:43 +0200
Raw View
On 20 November 2013 17:02, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 20 November 2013 16:52, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7=
<dm.leontiev7@gmail.com> wrote:
>> I want B to override function. And I want A to override function. I want=
B
>> to not no override function A already overrided.
>>
>> The problem is B overrides function() in _both_ parent classes. I want i=
t to
>> override only one function() in one parent.
>
>
> So.. when B converts itself to a A* or A&, you want A::function to be use=
d, and
> when B converts itself to an EventHandler* or EventHandler&, you want
> B::function
> to be used?
>
> I fail to see how such things are common enough to make a language change
> to support it.
As an alternative.. let's say we get a couple of reflection traits and
static if.
Then you could write the override in B, and write it something like
void B::function()
{
static if (has_pure_virtual_member_function<A, function, void
/*return type*/, void /*args*/>) {
/* the actual overriding code */ // A::function is pure,
override its functionality
} else {
A::function(); // A::function isn't pure, so do not override,
delegate to it
}
}
--=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: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JvQtdC+0L3RgtGM0LXQsg==?= <dm.leontiev7@gmail.com>
Date: Fri, 22 Nov 2013 17:42:56 +0400
Raw View
--bcaec54858f61d6a1e04ebc43133
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
That's a lot of code. And that's a lot of code which must be explicitly
added to every function which _may_ override a function in base class. A
developer of child class may forget to add it, a developer of parent class
may forget to mention names of functions which must be checks in
documentation.
Hiding a class from child classes is simplier, because all that should be
done is _not_ to touch vtable of protected class in constructor. That's
all. Just don't emit some assembly instructions and it will work.
Consider the following hierarchy of classes(let we use static keyword to
protect vtable):
class A {};
class B : private static A {};
class C : public B, private static A {}
for class C, we have the following VTable:
struct C_VTable {
struct A_VTable c_b_a; //C::B::A
struct B_VTable c_b; //C::B
struct A_VTable c_a; //C::A
...vtable of C...
};
This structure is generated in compile time, so no runtime checks will be
required. The compiler must not overwrite pointers in c_b_a with anything
except pointers to B methods. This feature will not require a lot of work
from compiler developers.
2013/11/22 Ville Voutilainen <ville.voutilainen@gmail.com>
> On 20 November 2013 17:02, Ville Voutilainen
> <ville.voutilainen@gmail.com> wrote:
> > On 20 November 2013 16:52, =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9 =
=D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D1=8C=D0=B5=D0=B2 <dm.leontiev7@gmail.com>
> wrote:
> >> I want B to override function. And I want A to override function. I
> want B
> >> to not no override function A already overrided.
> >>
> >> The problem is B overrides function() in _both_ parent classes. I want
> it to
> >> override only one function() in one parent.
> >
> >
> > So.. when B converts itself to a A* or A&, you want A::function to be
> used, and
> > when B converts itself to an EventHandler* or EventHandler&, you want
> > B::function
> > to be used?
> >
> > I fail to see how such things are common enough to make a language chan=
ge
> > to support it.
>
> As an alternative.. let's say we get a couple of reflection traits and
> static if.
> Then you could write the override in B, and write it something like
>
> void B::function()
> {
> static if (has_pure_virtual_member_function<A, function, void
> /*return type*/, void /*args*/>) {
> /* the actual overriding code */ // A::function is pure,
> override its functionality
> } else {
> A::function(); // A::function isn't pure, so do not override,
> delegate to it
> }
> }
>
> --
>
> ---
> 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/XHPXdG01rBY/=
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/.
--bcaec54858f61d6a1e04ebc43133
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>That's a lot of code. And that's a lot of cod=
e which must be explicitly added to every function which _may_ override a f=
unction in base class. A developer of child class may forget to add it, a d=
eveloper of parent class may forget to mention names of functions which mus=
t be checks in documentation. </div>
<div>=C2=A0</div><div>Hiding a class from child classes is simplier, becaus=
e all that should be done is _not_ to=C2=A0touch vtable of protected class =
in constructor. That's all. Just don't emit some assembly instructi=
ons and it will work.<br>
</div><div>Consider the following hierarchy of classes(let we use static ke=
yword to protect vtable): </div><div>=C2=A0</div><div>class A {};</div><div=
>class B : private static A {};</div><div>class C : public B, private stati=
c A {}</div>
<div>=C2=A0</div><div>for class C, we have the following VTable:</div><div>=
=C2=A0</div><div>struct C_VTable {</div><div>=C2=A0=C2=A0 struct A_VTable c=
_b_a; //C::B::A</div><div>=C2=A0=C2=A0 struct B_VTable c_b;=C2=A0=C2=A0=C2=
=A0 //C::B</div><div>=C2=A0=C2=A0 struct A_VTable c_a;=C2=A0=C2=A0=C2=A0 //=
C::A</div>
<div>=C2=A0=C2=A0=C2=A0...vtable of C...<br>};</div><div>=C2=A0</div><div>T=
his structure is=C2=A0generated in compile time, so no runtime checks will =
be required. The compiler must not overwrite pointers in c_b_a with=C2=A0an=
ything except pointers to B methods. This feature will not require a lot of=
work from compiler developers.</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11=
/22 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutila=
inen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
On 20 November 2013 17:02, Ville Voutilainen<br>
<div class=3D"im"><<a href=3D"mailto:ville.voutilainen@gmail.com">ville.=
voutilainen@gmail.com</a>> wrote:<br>
> On 20 November 2013 16:52, =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9 =
=D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D1=8C=D0=B5=D0=B2 <<a href=3D"mailto:dm.l=
eontiev7@gmail.com">dm.leontiev7@gmail.com</a>> wrote:<br>
>> I want B to override function. And I want A to override function. =
I want B<br>
>> to not no override function A already overrided.<br>
>><br>
>> The problem is B overrides function() in _both_ parent classes. I =
want it to<br>
>> override only one function() in one parent.<br>
><br>
><br>
> So.. when B converts itself to a A* or A&, you want A::function to=
be used, and<br>
> when B converts itself to an EventHandler* or EventHandler&, you w=
ant<br>
> B::function<br>
> to be used?<br>
><br>
> I fail to see how such things are common enough to make a language cha=
nge<br>
> to support it.<br>
<br>
</div>As an alternative.. let's say we get a couple of reflection trait=
s and<br>
static if.<br>
Then you could write the override in B, and write it something like<br>
<br>
void B::function()<br>
{<br>
=C2=A0 =C2=A0 static if (has_pure_virtual_member_function<A, function, v=
oid<br>
/*return type*/, void /*args*/>) {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0/* the actual overriding code */ // A::function =
is pure,<br>
override its functionality<br>
=C2=A0 =C2=A0 } else {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 A::function(); // A::function isn't pure, s=
o do not override,<br>
delegate to it<br>
<div class=3D"HOEnZb"><div class=3D"h5">=C2=A0 =C2=A0 }<br>
}<br>
<br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY=
/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>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--bcaec54858f61d6a1e04ebc43133--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 22 Nov 2013 15:51:41 +0200
Raw View
On 22 November 2013 15:42, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7 <=
dm.leontiev7@gmail.com> wrote:
> That's a lot of code. And that's a lot of code which must be explicitly
> added to every function which _may_ override a function in base class. A
> developer of child class may forget to add it, a developer of parent clas=
s
> may forget to mention names of functions which must be checks in
> documentation.
>
> Hiding a class from child classes is simplier, because all that should be
> done is _not_ to touch vtable of protected class in constructor. That's a=
ll.
> Just don't emit some assembly instructions and it will work.
> Consider the following hierarchy of classes(let we use static keyword to
> protect vtable):
>
> class A {};
> class B : private static A {};
> class C : public B, private static A {}
>
> for class C, we have the following VTable:
>
> struct C_VTable {
> struct A_VTable c_b_a; //C::B::A
> struct B_VTable c_b; //C::B
> struct A_VTable c_a; //C::A
> ...vtable of C...
> };
>
> This structure is generated in compile time, so no runtime checks will be
> required. The compiler must not overwrite pointers in c_b_a with anything
> except pointers to B methods. This feature will not require a lot of work
> from compiler developers.
An implementation will need to flag the member functions, and check
the flagging when instantiating a template with a dependent base
to do the right thing. It's not exactly a trivial change.
--=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: =?UTF-8?B?0JTQvNC40YLRgNC40Lkg0JvQtdC+0L3RgtGM0LXQsg==?= <dm.leontiev7@gmail.com>
Date: Fri, 22 Nov 2013 17:51:04 +0400
Raw View
--047d7b3433922edafa04ebc44e9c
Content-Type: text/plain; charset=KOI8-R
Content-Transfer-Encoding: quoted-printable
Yes, exactly. This feature can help to protect class internals from
unintended overrides, because sometimes one can't use final keyword. it is
easy to implement, because it only affects the Vtable generation at compile
time
2013/11/20 Ville Voutilainen <ville.voutilainen@gmail.com>
> On 20 November 2013 16:52, =E4=CD=C9=D4=D2=C9=CA =EC=C5=CF=CE=D4=D8=C5=D7=
<dm.leontiev7@gmail.com>
> wrote:
> > I want B to override function. And I want A to override function. I wan=
t
> B
> > to not no override function A already overrided.
> >
> > The problem is B overrides function() in _both_ parent classes. I want
> it to
> > override only one function() in one parent.
>
>
> So.. when B converts itself to a A* or A&, you want A::function to be
> used, and
> when B converts itself to an EventHandler* or EventHandler&, you want
> B::function
> to be used?
>
> I fail to see how such things are common enough to make a language change
> to support it.
>
> --
>
> ---
> 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/XHPXdG01rBY/=
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/.
--047d7b3433922edafa04ebc44e9c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Yes, exactly. This feature can help to protect class =
internals from unintended overrides, because sometimes one can't use fi=
nal keyword. it is easy to implement, because it only affects the Vtable ge=
neration at compile time</div>
</div><div class=3D"gmail_extra"><br><br><div class=3D"gmail_quote">2013/11=
/20 Ville Voutilainen <span dir=3D"ltr"><<a href=3D"mailto:ville.voutila=
inen@gmail.com" target=3D"_blank">ville.voutilainen@gmail.com</a>></span=
><br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">
<div class=3D"im">On 20 November 2013 16:52, =D0=94=D0=BC=D0=B8=D1=82=D1=80=
=D0=B8=D0=B9 =D0=9B=D0=B5=D0=BE=D0=BD=D1=82=D1=8C=D0=B5=D0=B2 <<a href=
=3D"mailto:dm.leontiev7@gmail.com">dm.leontiev7@gmail.com</a>> wrote:<br=
>
> I want B to override function. And I want A to override function. I wa=
nt B<br>
> to not no override function A already overrided.<br>
><br>
> The problem is B overrides function() in _both_ parent classes. I want=
it to<br>
> override only one function() in one parent.<br>
<br>
<br>
</div>So.. when B converts itself to a A* or A&, you want A::function t=
o be used, and<br>
when B converts itself to an EventHandler* or EventHandler&, you want<b=
r>
B::function<br>
to be used?<br>
<br>
I fail to see how such things are common enough to make a language change<b=
r>
to support it.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br>
--<br>
<br>
---<br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY/unsubscribe" target=3D"_blan=
k">https://groups.google.com/a/isocpp.org/d/topic/std-proposals/XHPXdG01rBY=
/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>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--047d7b3433922edafa04ebc44e9c--
.
Author: Philipp Stephani <p.stephani2@gmail.com>
Date: Sat, 23 Nov 2013 17:00:22 +0100
Raw View
--001a11c3675e7032e804ebda3acf
Content-Type: text/plain; charset=ISO-8859-1
2013/11/20 Dmitry Leontiev <dm.leontiev7@gmail.com>
> //resides in some popular shared library
> class A : private EventHandler {
> A(){
> source1.RegisterEventHandler(this);
> }
> private:
> void function(){printf("a");}
> };
> //imlemented by a developer who is unaware of A internals
>
I think here lies the problem: All virtual functions are part of the public
interface, independent of their visibility. That A overrides function is
not an internal of A, but part of its interface, and authors of subclasses
need to take it into account.
--
---
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/.
--001a11c3675e7032e804ebda3acf
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
2013/11/20 Dmitry Leontiev <span dir=3D"ltr"><<a href=3D"mailto:dm.leont=
iev7@gmail.com" target=3D"_blank">dm.leontiev7@gmail.com</a>></span><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"><div>//resides in some popular shared library<br></div><di=
v>class A :=A0private EventHandler {<br> =A0=A0=A0 A(){<br> =A0=A0=A0 =
=A0=A0 source1.RegisterEventHandler(this);<br> =A0=A0=A0 }</div><div>priva=
te:<br>=A0=A0=A0=A0=A0 void function(){printf("a");}<br>
};</div><div>//imlemented=A0by a developer who is unaware of A internals<br=
></div></div></blockquote><div><br></div><div>I think here lies the problem=
: All virtual functions are part of the public interface, independent of th=
eir visibility. That A overrides function is not an internal of A, but part=
of its interface, and authors of subclasses need to take it into account.=
=A0</div>
</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" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />
--001a11c3675e7032e804ebda3acf--
.