Class Diagram Examples & Templates

Class diagrams represent the static structure of a system by showing its classes, attributes, methods, and the relationships between classes.

When to Use Class Diagrams

Use class diagrams to design object-oriented systems, document database schemas, show inheritance hierarchies, and model the structure of your application.

Common Use Cases:

  • Object-oriented system design
  • Database schema modeling
  • Entity relationship mapping
  • Domain model documentation
  • Software architecture planning

Featured Class Diagram Examples

Explore 3 real-world class diagram examples with detailed explanations and PlantUML source code.

PassengerpassengerId: stringname: stringcontactInfo: stringFlightflightNumber: stringdepartureTime: datetimearrivalTime: datetimeFlightDescriptionroute: stringorigin: stringdestination: stringAirplaneserialNumber: stringmodel: stringSeatseatNumber: stringclass: stringBookingbookingId: stringstatus: stringmade by11reserves1111operated by11composed of1manyfollowsmany1

Flight Reservation System

Class diagram modeling the components of an airline booking system, including passengers, flights, and bookings.

View Example
Library Management System - Class DiagramLibrary Management System - Class DiagramLibraryItemid: Stringtitle: Stringisbn: Stringstatus: ItemStatusgetId(): StringgetTitle(): StringisAvailable(): BooleancalculateLateFee(days: int): MoneygetMaxLoanPeriod(): intPersonid: StringfirstName: StringlastName: Stringemail: StringgetFullName(): StringgetMaxBorrowLimit(): intBookauthor: Stringgenre: StringpageCount: intgetAuthor(): StringcalculateLateFee(days: int): MoneygetMaxLoanPeriod(): intDVDdirector: Stringduration: intrating: StringgetDirector(): StringcalculateLateFee(days: int): MoneygetMaxLoanPeriod(): intMagazineissueNumber: intvolume: intgetIssueInfo(): StringcalculateLateFee(days: int): MoneygetMaxLoanPeriod(): intMembermembershipType: MembershipTypemembershipDate: Datefines: MoneygetMembershipType(): MembershipTypepayFine(amount: Money): voidgetMaxBorrowLimit(): intcanBorrow(): BooleanLibrarianemployeeId: Stringdepartment: StringprocessLoan(member: Member, item: LibraryItem): LoanprocessReturn(loan: Loan): voidaddNewItem(item: LibraryItem): voidgetMaxBorrowLimit(): intLoanloanId: StringloanDate: DatedueDate: DatereturnDate: DatelateFee: MoneyisOverdue(): BooleancalculateLateFee(): Moneyrenew(): BooleanmarkReturned(): voidReservationreservationId: StringreservationDate: Datepriority: intisActive(): Booleancancel(): voidfulfill(): LoanLibraryname: Stringcatalog: CatalogsearchItems(query: String): List<LibraryItem>registerMember(person: Person): MemberprocessLoan(member: Member, item: LibraryItem): LoanCatalogitems: Map<String, LibraryItem>addItem(item: LibraryItem): voidremoveItem(itemId: String): voidsearchByTitle(title: String): List<LibraryItem>getAvailableItems(): List<LibraryItem>ItemStatusAVAILABLECHECKED_OUTRESERVEDDAMAGEDMembershipTypeSTUDENTFACULTYCOMMUNITYPREMIUMMoneyamount: BigDecimalcurrency: Stringadd(other: Money): MoneyisZero(): BooleanAbstract base class for allitems that can be borrowedfrom the libraryAssociation class representingthe borrowing relationshipbetween Member and LibraryItemManages the library'scollection with searchand inventory capabilitiescontainsmanagesborrowsloaned inprocessesmakesreservedhas membersemploys

Library Management System

Comprehensive class diagram demonstrating advanced object-oriented design principles including inheritance, abstract classes, and association classes in a library management system.

View Example
Pizza Parlor Ordering SystemPizza Parlor Ordering SystemCustomercustomerID: Stringname: Stringphone: Stringaddress: StringplaceOrder(): OrderOrderorderID: StringorderDate: DatetotalPrice: Doublestatus: OrderStatuscalculateTotal(): DoubleaddItem(item: MenuItem, quantity: Integer): voidsetStatus(status: OrderStatus): voidOrderStatusPLACEDPREPARINGBAKINGREADYDELIVEREDCANCELLEDOrderItemquantity: IntegergetSubtotal(): DoubleMenuItemname: Stringprice: DoublegetPrice(): DoublePizzasize: PizzaSizecrust: CrustTypeaddTopping(topping: Topping): voidsetSauce(sauce: Sauce): voidgetPrice(): DoubleSideDishdescription: StringgetPrice(): DoubleDrinkvolume: StringgetPrice(): DoublePizzaSizeSMALLMEDIUMLARGEEXTRA_LARGECrustTypeTHINTHICKSTUFFEDGLUTEN_FREEToppingname: Stringprice: Doublecategory: ToppingCategoryToppingCategoryMEATVEGETABLECHEESESAUCESaucename: Stringdescription: StringAssociation class that linksOrder to MenuItem with quantityCustomizable pizza withmultiple toppings and saucePrice = base price + toppingsAbstract base class forall orderable itemsExample calculation:totalPrice = sum of allOrderItem.getSubtotal()places10..*contains11..*refers to0..*1has10..*has11

Pizza Parlor Ordering System

A class diagram modeling an online or in-store pizza ordering system where customers can order customizable pizzas, side dishes, and drinks. Demonstrates object-oriented design principles including inheritance, composition, and associations.

View Example

How to Create Class Diagrams in PlantUML

With Plantdiagrams AI-powered editor, you can create professional class diagrams in seconds. Simply describe what you want to diagram, and our AI will generate the PlantUML code for you.

1

Open the Editor

Start with our free online PlantUML editor - no installation required.

2

Describe Your Diagram

Use our AI assistant to generate class diagram code from natural language.

3

Customize & Export

Edit the diagram with live preview, then export or share with your team.

Need More Examples?

Explore our full gallery of PlantUML diagram examples across all diagram types and industries.