Skip to content

Commit 2ee999e

Browse files
committed
txs auto checkin
1 parent a7436cf commit 2ee999e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

rust.tex

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,19 +2632,28 @@ \section{Object-Oriented Programming Features of Rust}
26322632
\item Inheritance is a mechanism whereby an object can inherit elements from another object’s definition, thus gaining the parent object’s data and behavior without you having to define them again.
26332633
\begin{itemize}
26342634
\item If a language must have inheritance to be an object-oriented language, then \textbf{Rust is not one}.
2635-
\item You can do this in a limited way in Rust code using default trait method implementations.
2635+
\item You can do this in a \textbf{limited way} in Rust code using default \textbf{trait} method implementations.
26362636
\end{itemize}
26372637

26382638
\end{itemize}
26392639
\end{frame}
26402640

26412641

26422642
\begin{frame}[fragile]
2643-
\frametitle{Encapsulation}
2643+
\frametitle{Encapsulation that Hides Implementation Details}
26442644

26452645
\begin{itemize}
26462646
\item Another aspect commonly associated with OOP is the idea of encapsulation, which means that the implementation details of an object aren’t accessible to code using that object.
2647+
\item Therefore, the only way to interact with an object is through its \textbf{public} API.
26472648
\end{itemize}
2649+
2650+
\begin{columns}
2651+
\column{0.5\textwidth}
2652+
\inputminted[fontsize=\scriptsize]{rust}{./code/oop1.rs}
2653+
\column{0.5\textwidth}
2654+
\inputminted[firstnumber=15, fontsize=\scriptsize]{rust}{./code/oop2.rs}
2655+
\end{columns}
2656+
26482657
\end{frame}
26492658

26502659

0 commit comments

Comments
 (0)