Search code examples
umlplantuml

Is there a syntax to define inheritence inside of class definitions in PlantUML?


For class diagrams, the examples I've seen look like

class A{
  [snip] list of class features
} 
class B{
  [snip] list of class features
}

A <|-- B

i.e. the inheritance arrow is explicitly called out.

Is there a valid synax where I can just say something like:

class A{
} 
class B: public A {
}

and automatically getting the inheritance arrow in the resulting diagram?


Solution

  • Yes. Both inheritance and interface implementation are supported.

    class A extends B
    class C implements D
    

    However, the members are not duplicated in the classes. It simply takes care of the relationship arrow.