[Uml-devel] about constructors

Paulo Sehn paulo.sehn at gmail.com
Fri Jul 15 09:50:42 UTC 2005


I have a question about this function :

operation.cpp:391

bool UMLOperation::isConstructorOperation() {
    UMLClassifier * c = dynamic_cast<UMLClassifier*>(this->parent());

    QString cName = c->getName();
    QString opName = getName();
    QString opReturn = getTypeName();

    // its a constructor operation if the operation name and return type
    // match that of the parent classifier
    return (cName == opName && cName == opReturn) ? true : false;
}

Why a constructor should have a return type of its type ? (cName ==
opName && cName == opReturn)

As far as understand a constructor ir a operation with the same name
of the class, and have no return type. I've read that UML is not very
clear about constructors but could we use return (cName == opName)
instead of the expression above ?

Regards,
Paulo Sehn




More information about the umbrello-devel mailing list