structs vs classes
Jim
bitcirkel at yahoo.com
Sat Jan 29 06:13:51 PST 2011
I'm only discussing the heap/stack difference.
so Wrote:
> > I'm a bit troubled with the class/struct dichotomy. I would prefer them
> > both to use the same keyword. Heap/stack allocation could be specified
> > during instantiation instead. Why? Now you need to choose one over the
> > other. Not even C++ has this limitation.
>
> This keeps coming and i have no idea how people think C++ treatment is any
> way good.
> You are free to call the D design of struct/class the worst possible, but
> at least don't base your reasoning to C++ please.
>
> C++: both class and struct are exactly same, except one trivial:
>
> struct A : B {
> };
>
> means:
>
> class A : public B {
> public:
> };
>
> In D they are quite different and they have different keywords.
>
> http://www.digitalmars.com/d/2.0/class.html
> http://www.digitalmars.com/d/2.0/struct.html
More information about the Digitalmars-d
mailing list