Does new X() return a pointer or not?

faissaloo faissaloo at gmail.com
Sat Apr 6 13:34:06 UTC 2019


I have the following function

	static Component* constructComponent(int value) {
		return (new ComponentChild(value));
	}

ComponentChild is a derived class of Component.
However, I get told that ComponentChild cannot be converted to 
Component*. I'm confused here, does new return a heap pointer or 
not? Are objects automatically assumed to be pointers?


More information about the Digitalmars-d-learn mailing list