Why can't structs be derived from?

Daniel Gibson metalcaedes at gmail.com
Tue Mar 15 14:59:59 PDT 2011


Am 15.03.2011 22:46, schrieb Jens:
> Jonathan M Davis wrote:
>> On Tuesday, March 15, 2011 14:15:48 Max Samukha wrote:
>>>
>>> Class objects are possible on stack in D.
>>
>> Yes, but only with the help of the standard library:
>> std.typecons.scoped. scoped classes are going to be removed from the
>> language. It really shouldn't normally be the case that a class
>> object is put on the case.
>>
> 
> And the language-idiomatic things are the ones to focus on rather than 
> "it can be done". 
> 
> 

Right.
And D is not C++ so you shouldn't try to do everything exactly like in
C++, D has its own idioms.
As said before: You can do almost everything in D that you can do in C++ (except
for multiple inheritance, but you can kind-of do that with alias this), but it
often is preferred to do stuff differently.



More information about the Digitalmars-d mailing list