D versus Objective C Comparison

Walter Bright newshound1 at digitalmars.com
Sun Feb 1 11:45:58 PST 2009


Jacob Carlborg wrote:
> It would be great if D could have categories/open classes and you could 
> do something like this:
> 
> class A
> {
>     void foo () {}
> }
> 
> class A
> {
>     void bar () {}
> }
> 
> void main ()
> {
>     auto a = new A;
>     a.foo;
>     a.bar;
> }
> 
> And it should of course work on classes you don't have access to the 
> source code.

Setting aside the technical issues for the moment, isn't that exactly 
what inheritance is supposed to be good for?



More information about the Digitalmars-d mailing list