On Saturday, 20 April 2013 at 17:24:33 UTC, John Colvin wrote:
On Saturday, 20 April 2013 at 16:36:09 UTC, Namespace wrote:
It works fine in C++ (of course with -std=c++0x)
http://codepad.org/qLIjGGd4

It's been a while since I did any c++ but:

1) I don't see any pointer to pointer polymorphism in there.

2) That c++ code is equivalent to the version of your D code that works, not the version that doesn't.

I return a pointer from an instance of B and the compiler cast it implicit to A*. Look what is inside of 'bstore' (instances of B) and what the type of 'get' is (A*).

And no, the equivalent version would use 'A' as return type of 'get', not 'A*'.

Reply via email to