本文发表在 rolia.net/zh 相约加拿大网上社区枫下论坛
But I have to ask the further information:
1> It is C++ compiler error, right?
In the general OO languaes concept,
this should not be hidden, right?
See the special example:
if basecalss has 100 overloaded functions which
are using the same name but different argues, but derived calss only
want to override one of them and want to act the same way
to all others.
The current C++ compiler will hide the others, so derived calss has
to declare them again to call the superclass.
Is ir reasonable?
I thinkn it break the basic OO concepts.
2> Is there any one here know about the Vtbl &vptr?
Of course, if you know, you will tell me the VTBL for d1 & d2 (in my previoud example) shoulb be same, but the overloaded function in d1 VTBL will be hidden by C++ compiler?
And you might tell me, you can use some way to call the hidden functions.
Ok, if so, I mean we can call the hidden function by some way (not directly),
why the C++ compiler hidden from user directly calling?
Is there ant benifits or good reasons?
So I think there might be some hidden reason which make the 2 VTBL actually different, but it seems "SAME" to us at our currrent undersanding and test.
Is there anyone know the detailed, hidden reason if it exist?
or give me a reason why C++ need to do so?
更多精彩文章及讨论，请光临枫下论坛. 网址: rolia.net/zh