[antlr-interest] anybody get bitten by ANTLR's AST interface requirement

Sohail Somani sohail at taggedtype.net
Mon Jan 23 19:44:25 PST 2006


On Mon, 2006-01-23 at 17:48 +0530, Krishanu Debnath wrote:
> Sohail Somani wrote:
> > On Fri, 2006-01-20 at 09:49 +0100, Martin Probst wrote:
> >> A 1.5 feature I consider quite important never gets mentioned btw:
> >> overriding methods can now declare a subclass as the return type, e.g.
> >> if you have "class B extends A {}" and some method "A doFoo()" you can
> >> override it to "B doFoo()". User correctly this can significantly
> >> enhance APIs and type safety.
> > 
> > I think these are called covariant returns in the C++ world. Are they
> > the same idea?
> > 
> No. This is not allowed in C++. Functions declarations that differ only in the
> return type cannot be overloaded.

Ah. Clarified. doFoo() are in the same class.

Thanks!




More information about the antlr-interest mailing list