D versus Objective C Comparison

Jacob Carlborg doob at me.com
Mon Feb 2 09:05:41 PST 2009


Walter Bright wrote:
> 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?

A few times I've had the need for this, I've always been able to solve 
the problem but it would have been easier with support for this. But to 
be honest I don't remember these problems right now, so perhaps it's not 
that important.



More information about the Digitalmars-d mailing list