\documentclass[12pt,article]{article}
\usepackage{tikzscale}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\linespread{1.05}
\usepackage{tikz}
\pgfdeclarelayer{background,foreground}
\pgfsetlayers{background,main,foreground}
\usepackage{tikz-uml}
\usepackage{amsmath}
\usepackage{savetrees}
%\usepackage{pgf-umlcd}
%\usepackage{pgfmanual}
\begin{document}
\begin{figure}[h!]
\begin{tikzpicture}
\begin{umlpackage}{airline class diagram}
\umlclass[x=5,y=-6]{passenger }{+ name : string\\ + Age : int \\ + address : string }{+ searchflight() \\ + viewSchedule() \\ + reserveseat() \\ + purchaseTicket()\\ + cancleTicket()\\ + Payment()}
\umlclass[x=5,y=-1]{Payment }{+ Amount }{}
\umlclass[x=-2,y=-6]{Ticket }{+ ticketno \\ + StartingLocation \\ + DestinationLocation \\ + PassengerNo }{ + cancleTicket() \\ + Payment( ) }
\umlclass[x=11,y=-1]{ticketClerk }{+ name \\ + Location }{+ reserveseat() \\ + reserveTicket()\\ + cancleTicket()\\ + receivePayment()}
\umlclass[x=11,y=-6]{airline database }{+ id }{ +response()}
\umlclass[x=5,y=-12]{Plane }{+ model \\ +capacity \\ + flightNo. }
\umlassoc{Ticket}{passenger}
\end{umlpackage}
\end{tikzpicture}
\end{figure}
\end{document}
我运行此代码然后发现一个错误
! Package pgf Error: No shape named Ticket is known.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.28 \umlassoc{Ticket}{passenger}