Book a Demo

Author Topic: C++ virtual method shown italic?  (Read 7628 times)

tletsch

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
C++ virtual method shown italic?
« on: January 22, 2010, 09:06:01 pm »
Hello

Why is in C++ a virtual method in the classdiagramm shown in italic letters?

UML defines italic for abstract methods, which in C++ would be a "pure virtual method", e.g. "virtual void meth() = 0;".
(This is also done perfectly if I set the method to 'Pure').

Thanks for any hint
Thomas

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: C++ virtual method shown italic?
« Reply #1 on: January 23, 2010, 03:53:16 am »
HI Thomas,

From where exactly did you get this information? I can'r find anything about your statement
Quote
UML defines italic for abstract methods
in the UML 2.2 superstructure definition (see 7.3.36 Operation (from Kernel, Interfaces).
May be I was looking in the wrong place for this.
I only found that for abstract class definitions there's an entry in the 'Style Guidline' section (7.3.7 Class (from Kernel)):
"• Put the class name in italics if the class is abstract."

I'm afraid how to render this is left open to the UML case tool vendor ...

HTH
Günther

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: C++ virtual method shown italic?
« Reply #2 on: January 23, 2010, 05:54:16 am »
Günther,

You are (of course?) right, but you have to admit that it is a widely accepted convention to show abstract operations in italics
Showing virtual operations in italics is just plain misleading.

Geert

tletsch

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: C++ virtual method shown italic?
« Reply #3 on: January 24, 2010, 09:07:48 pm »
Hello Günther

You are right.
To be honest, I know about that only from various UML-books. I didn't consult the UML-Specs :-(
Because I have never seen or read something else I thought it was defined that way.
When I first saw this in EA I was a little confused.

Maybe this comes from the fact, that in Java the Operation-Dialog has only one difference: the virtual-checkbox (in C++) is there the abstract-checkbox (in Java).
So in Java the behaviour for this checkbox is as expected (sets the letters to italic).

I ask myself, if it would be worth to place a request for this in "Suggestions and Requests" because it seems to be misleading (as Geert noted).

Thomas

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: C++ virtual method shown italic?
« Reply #4 on: January 25, 2010, 09:03:56 pm »
OK, to be honest I had to look up this myself. The question just made me curious. I didn't really came over this problem to have to distinguish this for clarity in a diagram.
Usually I'm putting any pure virtual C++ methods into <<interface>> elements. They'll appear in realizing classes only (I let them do so), if they are implemented and therefore
have a body.
That way I never had to distinguish between abstract and virtual operations, because they won't appear intermixed within a single element (class).

Just my 0.02 EUR

günther