On 7/24/17 11:21 AM, Houdini wrote:
Hello,
I am a C++ coder, and I am learning D (just reading a book, for now).
D is very similar to C++ (and also grabs godd ideas from Python), but I
have a naive question : why does Walter Bright chose to instanciate
classes like in Java ? And why is it different for structs ?
Because types with inheritance generally don't work right if you pass by
value (i.e. the slicing problem).
structs don't support inheritance or virtual functions, so they can be
safely passed by value.
-Steve