Re: pure virtual functions and name injection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jérôme,

> Ok, i guess this is because of the same name...

Yes, that is correct.

>...but why is it ok with the C++ standard?
> operator++(int) and operator++() do have the same name, but they are
> considered
> as different by a c++ compiler...

I'm not sure.  I suspect it's a C legacy allowance.  A kluge.  A wart in the
C++ standard.

> Technically, a::foo() is not "defined" anywhere (i understand what
> you mean),
> but it does not need to, since it is a pure virtual functions.
> But a::foo() is "implemented" in class "d" (return 1), so when
> calling a::foo() the
> compiler should redirect the call to the implementation d::foo(), no?

No.

a::foo() is not d::foo().

foo() goes through the virtual function table.  a::foo() is explicitly
a::foo().

HTH,
--Eljay



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux