distinguish between classes and structures
Weed
resume755 at mail.ru
Sun Dec 14 23:19:59 PST 2008
Bill Baxter пишет:
> On Mon, Dec 15, 2008 at 3:35 PM, Weed <resume755 at mail.ru> wrote:
>> Who can provide a link to an explanation about why in D has taken to
>> distinguish between classes and structures?
>>
>> (Sorry for my bad English)
>>
>
> The main justification is eliminating the slicing problem.
> http://cplusplusgems.blogspot.com/2005/10/what-is-slicing-problem-class-base.html
>
> D solves it by making it impossible to have a class instance as a value type.
>
Why not disallow the casting for structs, leaving the possibility of up
casting for the links and pointers to the structure?
More information about the Digitalmars-d-learn
mailing list