What is difference between struct and class?
Rnd
r_narang at yahoo.com
Mon Jun 3 09:43:25 UTC 2019
On Monday, 3 June 2019 at 08:54:12 UTC, Jonathan M Davis wrote:
> structs in D are basically the same as C++ classes that don't
> have inheritance and can be put on the stack or the heap, and
> classes in D are akin to C++ classes that use inheritance and
> are always put on the heap and used via pointers. D classes are
> similar to Java classes in that respect.
>
> - Jonathan M Davis
Also struct in D seem to be very similar to classes in C except
lack of inheritance.
These similarities and differences should be highlighted in
documentation etc since many new users have at least some
knowledge of C/C++ and understanding will be easier.
More information about the Digitalmars-d-learn
mailing list