You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
\item\textbf{Message passing} is a fine way of handling concurrency, but\textbf{ it’s not the only one}. Another method would be for multiple \textbf{threads to access the same shared data}.
2609
+
\item In a way, \textbf{channels} in any programming language are \textbf{similar to single ownership}, because once you transfer a value down a channel, you should no longer use that value. \textbf{Shared memory} concurrency is like \textbf{multiple ownership}: multiple threads can access the same memory location at the same time.
2610
+
\end{itemize}
2611
+
\end{frame}
2612
+
2613
+
2585
2614
\section{Object-Oriented Programming Features of Rust}
2615
+
2616
+
\begin{frame}[fragile]
2617
+
\frametitle{Objects Contain Data and Behavior}
2618
+
\begin{block}{The book Design Patterns (The Gang of Four): }
2619
+
Object-oriented programs are made up of objects. An object packages both \textbf{data} and the \textbf{procedures that operate on that data}. The procedures are typically called methods or operations.
2620
+
\end{block}
2621
+
2622
+
\begin{itemize}
2623
+
\item Using this definition, \textbf{Rust is object-oriented}: structs and enums have data, and impl blocks provide methods on structs and enums.
2624
+
\end{itemize}
2625
+
\end{frame}
2626
+
2627
+
2628
+
\begin{frame}[fragile]
2629
+
\frametitle{Inheritance}
2630
+
2631
+
\begin{itemize}
2632
+
\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.
2633
+
\begin{itemize}
2634
+
\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.
2636
+
\end{itemize}
2637
+
2638
+
\end{itemize}
2639
+
\end{frame}
2640
+
2641
+
2642
+
\begin{frame}[fragile]
2643
+
\frametitle{Encapsulation}
2644
+
2645
+
\begin{itemize}
2646
+
\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.
0 commit comments