new principle of division between structures and classes

Bill Baxter wbaxter at gmail.com
Fri Jan 9 17:47:42 PST 2009


On Wed, Jan 7, 2009 at 4:22 AM, Weed <resume755 at mail.ru> wrote:
> (Here I generalise my sentence with supplement)
>
>
> The POD data and the data supporting polymorphism are necessary to us.
> POD the data is stored in structs and polymorphic objects is classes.
>
> Both types (class and struct) can be instanced in a heap or on a stack.
> (And in invariant ROM too, but there it is not important)
>
> Classes and structures support inheritance. But structures do not
> support polymorphism (as are POD type without vptr) - at attempt to
> implement virtual function in structure the compiler will give out an
> error: "struct StructName is POD type, it is not support polymorphism,
> use class instead of". (And certainly structures are not inherited from
> classes, including from super class Object)
>
> Thus, the programmer always knows the object is POD-data or not. The
> problem of simple alteration of structure to a class and vice versa when
> necessary also solved.
>
> For an exception of splitting of objects it is necessary to check during
> compilation: or to forbid assignment on value for types not being to the
> data (how now it works for the structs objects on value) or to forbid
> the access to the fields added at descending inheritance (its more
> difficult but desirable)
>
>
> Please, state critical remarks

Your English is really hard to make sense of.
That's my guess for why there are no responses.
Heck, I'd *like* to respond, but I just can't tell what you're trying to say.

--bb



More information about the Digitalmars-d mailing list