With below code: class A { } class B { public: ref A createA() // ****without type name A is also OK.**** { return new A;//q1 } } Don't know whether this is a feature or a bug.
It's a feature. :) When you don't specify a type, the compiler tries to deduce it automatically.