<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://labviewwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Delegation_%28object-oriented_programming%29</id>
	<title>Delegation (object-oriented programming) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://labviewwiki.org/w/index.php?action=history&amp;feed=atom&amp;title=Delegation_%28object-oriented_programming%29"/>
	<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;action=history"/>
	<updated>2026-05-08T18:12:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14932&amp;oldid=prev</id>
		<title>Logmanoriginal: Add wikilinks</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14932&amp;oldid=prev"/>
		<updated>2020-04-12T12:17:04Z</updated>

		<summary type="html">&lt;p&gt;Add wikilinks&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:17, 12 April 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one object (the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that don&#039;t have native support for object delegation, the delegator may pass itself to the delegate to let it operate on behalf of the delegator. Alternatively, the delegator can keep an instance of the delegate in its private data and forward any delegate-specific behavior to it.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;object &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(object-oriented programming)|object]] &lt;/ins&gt;(the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Inheritance (object-oriented programming)|&lt;/ins&gt;inheriting&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;methods from a common ancestor, the delegator uses &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[composition (object-oriented programming)|&lt;/ins&gt;object composition&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]] &lt;/ins&gt;to reuse functionality of the delegate. In programming languages that don&#039;t have native support for object delegation, the delegator may pass itself to the delegate to let it operate on behalf of the delegator. Alternatively, the delegator can keep an instance of the delegate in its private data and forward any delegate-specific behavior to it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Logmanoriginal</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14931&amp;oldid=prev</id>
		<title>Logmanoriginal: Clarify the need for the delegator to pass itself to the delegate</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14931&amp;oldid=prev"/>
		<updated>2020-04-12T12:12:43Z</updated>

		<summary type="html">&lt;p&gt;Clarify the need for the delegator to pass itself to the delegate&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:12, 12 April 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one object (the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that don&#039;t have native support for object delegation, the delegator may pass itself to the delegate to let it operate on behalf of the delegator.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one object (the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that don&#039;t have native support for object delegation, the delegator may pass itself to the delegate to let it operate on behalf of the delegator&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;. Alternatively, the delegator can keep an instance of the delegate in its private data and forward any delegate-specific behavior to it&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Logmanoriginal</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14930&amp;oldid=prev</id>
		<title>Logmanoriginal: Fix typos</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14930&amp;oldid=prev"/>
		<updated>2020-04-12T12:05:52Z</updated>

		<summary type="html">&lt;p&gt;Fix typos&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 12:05, 12 April 2020&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one object (the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;doesn&lt;/del&gt;&#039;t have native support for object delegation, the delegator may &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;passes &lt;/del&gt;itself to the delegate to let it operate on behalf of the delegator.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In [[object-oriented programming]], &#039;&#039;&#039;delegation&#039;&#039;&#039; (sometimes referred to as &#039;&#039;delegation pattern&#039;&#039;) allows one object (the &#039;&#039;delegate&#039;&#039;) to operate on behalf of another object (the &#039;&#039;delegator&#039;&#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;don&lt;/ins&gt;&#039;t have native support for object delegation, the delegator may &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;pass &lt;/ins&gt;itself to the delegate to let it operate on behalf of the delegator.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;==Use case example==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Logmanoriginal</name></author>
	</entry>
	<entry>
		<id>https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14928&amp;oldid=prev</id>
		<title>Logmanoriginal: Add new page</title>
		<link rel="alternate" type="text/html" href="https://labviewwiki.org/w/index.php?title=Delegation_(object-oriented_programming)&amp;diff=14928&amp;oldid=prev"/>
		<updated>2020-04-12T12:03:59Z</updated>

		<summary type="html">&lt;p&gt;Add new page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In [[object-oriented programming]], &amp;#039;&amp;#039;&amp;#039;delegation&amp;#039;&amp;#039;&amp;#039; (sometimes referred to as &amp;#039;&amp;#039;delegation pattern&amp;#039;&amp;#039;) allows one object (the &amp;#039;&amp;#039;delegate&amp;#039;&amp;#039;) to operate on behalf of another object (the &amp;#039;&amp;#039;delegator&amp;#039;&amp;#039;) without the need for a common ancestor. Instead of inheriting methods from a common ancestor, the delegator uses object composition to reuse functionality of the delegate. In programming languages that doesn&amp;#039;t have native support for object delegation, the delegator may passes itself to the delegate to let it operate on behalf of the delegator.&lt;br /&gt;
&lt;br /&gt;
==Use case example==&lt;br /&gt;
Classes &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;, &amp;#039;&amp;#039;Square&amp;#039;&amp;#039;, &amp;#039;&amp;#039;Circle&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; inherit from a common ancestor &amp;#039;&amp;#039;Surface&amp;#039;&amp;#039;, which has a method &amp;#039;&amp;#039;Area&amp;#039;&amp;#039; to calculate the surface area.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed-overlay&amp;quot; widths=240px heights=240px&amp;gt;&lt;br /&gt;
File:Delegation - Example Main.png|Main VI&lt;br /&gt;
File:Delegation - Example Inheritance Hierarchy.png|Inheritance Hierarchy&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After closer inspection, the formulas for &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;, &amp;#039;&amp;#039;Square&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; are very similar and should reuse common functionality:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Class&lt;br /&gt;
! Equation&lt;br /&gt;
|-&lt;br /&gt;
| Rectangle&lt;br /&gt;
| &amp;lt;code&amp;gt;a * b&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Square&lt;br /&gt;
| &amp;lt;code&amp;gt;a * a&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Triangle&lt;br /&gt;
| &amp;lt;code&amp;gt;a * b / 2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Circle&lt;br /&gt;
| &amp;lt;code&amp;gt;PI*r^2&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Solution using inheritance===&lt;br /&gt;
&amp;#039;&amp;#039;Square&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; inherit from &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;, which implements the common functionality. In this case, &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; needs to override the &amp;#039;&amp;#039;Area&amp;#039;&amp;#039; method in order to complete its equation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed-overlay&amp;quot; widths=240px heights=240px&amp;gt;&lt;br /&gt;
File:Delegation - Example Using Inheritance - Inheritance Hierarchy.png|Inheritance Hierarchy&lt;br /&gt;
File:Delegation - Example Using Inheritance - Triangle overrides Rectangle.png|Triangle overrides Area method of Rectangle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This solution is considered bad practice, because &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; is not a &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;; the equation only happens to be based on rectangles. It also adds another layer of inheritance, which might not be desirable and can be problematic if classes require distinct behavior in the future.&lt;br /&gt;
&lt;br /&gt;
===Solution using delegation===&lt;br /&gt;
&amp;#039;&amp;#039;Square&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; use object composition to delegate some of their work to &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;. In this case, both &amp;#039;&amp;#039;Square&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; keep their own instance of &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039; in their private data and delegate any &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039;-specific behavior to it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed-overlay&amp;quot; widths=240px heights=200px&amp;gt;&lt;br /&gt;
File:Delegation - Example Using Delegation - Square delegates to Rectangle.png|Square delegates its work to Rectangle&lt;br /&gt;
File:Delegation - Example Using Delegation - Triangle delegates to Rectangle.png|Triangle delegates its work to Rectangle&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This solution requires extra work to implement, but if requirements change in the future, &amp;#039;&amp;#039;Rectangle&amp;#039;&amp;#039; can always be removed from either &amp;#039;&amp;#039;Square&amp;#039;&amp;#039; and &amp;#039;&amp;#039;Triangle&amp;#039;&amp;#039; without affecting any other classes.&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [[Wikipedia:Delegation (object-oriented programming)|Delegation]] on Wikipedia&lt;br /&gt;
* [https://forums.ni.com/t5/LabVIEW-Development-Best/Delegation-Pattern/ta-p/3491604 Applying Common Object-Oriented Design Patterns to LabVIEW: Delegation Pattern] by Elijah Kerry&lt;br /&gt;
&lt;br /&gt;
[[Category:Object-Oriented Programming]]&lt;br /&gt;
[[Category:Object-Oriented Design Pattern]]&lt;/div&gt;</summary>
		<author><name>Logmanoriginal</name></author>
	</entry>
</feed>