Why is AbstractFunctionDeclaration not a Declaration? Why is ClassFunctionDeclaration not a FunctionDeclaration?

David Nolden zwabel at googlemail.com
Mon Mar 1 15:15:04 UTC 2010


Am Montag 01 März 2010 16:01:56 schrieb Milian Wolff:
> Hey all, esp. David!
> 
> Is there any reason why an AbstractFunctionDeclaration does not inherit
>  from Declaration? And why is a ClassFunctionDeclaration only an
> AbstractFunctionDeclaration, but not a normal FunctionDeclaration?
> 
> I find that rather unintuitive and makes my code harder since I cannot use
> simple polymorphie to handle methods and functions (in my case no
>  difference) in one go...
> 
> Anything against me changing that?

This cannot be changed, due to multiple inheritance.

A ClassFunctionDeclaration inherits ClassMemberDeclaration as well as 
AbstractFunctionDeclaration, and a FunctionDeclaration inherits Declaration 
and AbstractFunctionDeclaration.

"Declaration" must be only once in the whole inheritance chain, and for that 
reason AbstractFunctionDeclaration is a pure abstract class that is just 
"added" to FunctionDeclaration and ClassFunctionDeclaration. The only other 
option would be making ClassMemberDeclaration such an abstract class, but that 
would be a rather useless change.




More information about the KDevelop-devel mailing list