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

Krishanu Debnath krishanu at cal.interrasystems.com
Mon Jan 23 04:18:51 PST 2006

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.


More information about the antlr-interest mailing list