UML 2.6 RTF Avatar
  1. OMG Issue

UMLR — Allow method bodies for abstract BehavioralFeatures

  • Key: UMLR-838
  • Status: open  
  • Source: N/A ( Robert Hairgrove)
  • Summary:

    In the section BehavioralFeature, section 9.9.2.8 "Constraints" on page 173:

    The constraint "abstract_no_method" declares: "When isAbstract is true there are no methods."

    At least for C++, this is NOT necessarily true because a member function declared as pure virtual can have a method body. However, the method can only be called using the fully qualified class name.

    This seems overly restrictive to me – there might have been a time when the C++ language disallowed method bodies for pure virtual functions, but I can't remember when that might have been ... in Scott Meyer's "Effective C++" 2nd edition, which dates from 1997, he remarks on page 162 that "it is possible to provide a definition for a pure virtual function (...)" and proceeds to illustrate different ways of calling the function.

    It might make more sense to define the constraint backwards, such that if "isAbstract" is false, that there must be a (possibly empty) method body.

  • Reported: UML 2.5.1 — Tue, 20 Aug 2024 11:41 GMT
  • Updated: Wed, 4 Sep 2024 14:13 GMT