Tuesday 6 June 2023

PlantUML: Define abstract methods in a class diagram

Abstract methods are defined using {abstract} modifier. This modifier can be used at start or end of the line.

 

abstractMethod.txt

@startuml

abstract class ArithmeticUtil{
	int sum(int a, int b)
	int mul(int a, int b)

	{abstract} int sub(int a, int b)
	int div(int a, int b) {abstract}

}

@enduml

 

Above snippet generate below diagram.




From the above diagram, you can notice

a.   Abstract class is annotated with letter ‘A’ in a circle

b.   Abstract methods are drawn in italic.

 

Previous                                                    Next                                                    Home

No comments:

Post a Comment