We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 376e6da commit 5bb3871Copy full SHA for 5bb3871
talk/objectorientation/operators.tex
@@ -94,6 +94,28 @@
94
\end{block}
95
\end{frame}
96
97
+\begin{frame}[fragile]
98
+ \frametitlecpp[98]{Chaining operators}
99
+ \begin{block}{In general, return a reference to the left value}
100
+ \begin{cppcode}
101
+ struct Complex {
102
+ float m_real, m_imaginary;
103
+ Complex& operator=( const Complex& other ) {
104
+ m_real = other.m_real;
105
+ m_imaginary = other.m_imaginary;
106
+ return *this;
107
+ }
108
+ };
109
+ Complex c1{2.f, 3.f};
110
+ Complex c2, c3;
111
+ // right to left associativity
112
+ c3 = c2 = c1;
113
+ // left to right associativity
114
+ std::cout << c1 << c2 << c3 << std::endl;
115
+ \end{cppcode}
116
+ \end{block}
117
+\end{frame}
118
+
119
\begin{frame}[fragile]
120
\frametitlecpp[98]{Friend declarations}
121
\begin{block}{Concept}
0 commit comments