<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Polymorphism on My C++ Technical Blog</title><link>https://konstantd.github.io/tags/polymorphism/</link><description>Recent content in Polymorphism on My C++ Technical Blog</description><generator>Hugo -- 0.155.3</generator><language>en-us</language><lastBuildDate>Tue, 16 Jun 2026 14:37:09 +0300</lastBuildDate><atom:link href="https://konstantd.github.io/tags/polymorphism/index.xml" rel="self" type="application/rss+xml"/><item><title>Rule of 5: It Is Not Just About the Destructor</title><link>https://konstantd.github.io/posts/class-member-functions-rules/</link><pubDate>Tue, 16 Jun 2026 14:37:09 +0300</pubDate><guid>https://konstantd.github.io/posts/class-member-functions-rules/</guid><description>&lt;p&gt;For resource managing in classes, &lt;strong&gt;do not think that move will always move&lt;/strong&gt;. It will fallback to copy if the object is not moveable. Or if the operation throws an exception, it will fall back to copy as well, so &lt;strong&gt;always mark&lt;/strong&gt; the move constructor as &lt;code&gt;noexcept&lt;/code&gt; as we saw on the &lt;a href="https://konstantd.github.io/posts/move-ctor-no-except/"&gt;previous blog about move semantics&lt;/a&gt;.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-cpp" data-lang="cpp"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#66d9ef"&gt;struct&lt;/span&gt; &lt;span style="color:#a6e22e"&gt;MyClass&lt;/span&gt;{
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; std&lt;span style="color:#f92672"&gt;::&lt;/span&gt;vector&lt;span style="color:#f92672"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#66d9ef"&gt;int&lt;/span&gt;&lt;span style="color:#f92672"&gt;&amp;gt;&lt;/span&gt; m_data;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#f92672"&gt;~&lt;/span&gt;MyClass() &lt;span style="color:#f92672"&gt;=&lt;/span&gt; &lt;span style="color:#66d9ef"&gt;default&lt;/span&gt;;
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;};
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Given the above class, consider the below lines:&lt;/p&gt;</description></item></channel></rss>