我试图延长SimpleXMLElement类提供一种机制,以子XML字符串或其他的SimpleXMLElement合并到我的的SimpleXMLElement,该代码是基于code written by Carlos C Soto in an answer的问题"PHP - SimpleXML - AddChild with another SimpleXMLElement"。 现在我在子类中只增
你觉得这一块的C++代码的内容: Polygon* p;
if(shape=="Rectangle")
p = new Rectangle();
else if(shape=="Triangle")
p = new Triangle();
else
exit(EXIT_FAILURE);
,其中矩形和三角形从基类派生的多边形。 它背后的想法是,我需要使用派生