Why can't structs be derived from?

Steven Wawryk stevenw at acres.com.au
Tue Mar 15 17:00:05 PDT 2011


On 16/03/11 04:59, Andrei Alexandrescu wrote:
> The reason for the allegedly ugly syntax is that it's considerably more
> general. It is often the case that a struct defines an entity that is
> implicitly convertible to another entity - could be an rvalue vs.
> lvalue, a class vs. another struct vs. a primitive type, could need a
> run-time operation etc. Inheritance would offer at best few of these
> amenities, whereas 'alias this' offers all with a simple syntax.

More general?!  How would you express the equivalent of 
static_cast<slist_node<T> >(base) in the original sample code?


More information about the Digitalmars-d mailing list