boost::shared_ptr<PartRepresentation> PartRepresentation::cloneSubtree() { boost::shared_ptr<PartRepresentation> theClone( new PartRepresentation(this->getId(), this->getOrientation(), this->getArity(), this->getType(), this->getParams(), this->getMotors(), this->getSensors())); // deep copy all children for (unsigned int i = 0; i < this->getArity(); i++) { if (this->getChild(i)) { theClone->setChild(i, this->getChild(i)->cloneSubtree()); } } return theClone; }
HtmlElement * HtmlImageElement::clone() const { HtmlElement * theClone(new HtmlImageElement(m_tagName)); copyAttributes(theClone); return theClone; }