ファニョン2号に…

ファニョン2号ことビョンリョル(やっと名前覚えた--;)が
演算子オーバーロードってヤツは使ってるのか?」
というので、説明の為に書いた。

class AValueClassExample
{
	private: int m_MemberVar;
	
	public: AValueClassExpample()
		: m_MemberVar(0)
	{
	}
	
	public: AValueClassExpample(const AValueClassExpample& rhs)
		: m_MemberVar(rhs.m_MemberVar)
	{
	}
	
	public: /* Must NOT virtual */ ~AValueClassExpample()
	{
	}
	
	public: AValueClassExpample& operator= (const AValueClassExpample& rhs)
	{
		m_MemberVar = rhs.m_MemberVar;
		
		return *this;
	}
};

class APolymorphicClassExpample
{
	private: int m_MemberVar;
	
	public: APolymorphicClassExpample()
		: m_MemberVar(0)
	{
	}
	
	private: APolymorphicClassExpample(const APolymorphicClassExpample& rhs);
	
	public: virtual ~APolymorphicClassExpample()
	{
	}
	
	private: APolymorphicClassExpample& operator= (const APolymorphicClassExpample& rhs);

};

// Value-class ... It is possible to copy, and It's member operator is overloadable too. but we can't inherit it.
// Polymorphic-class ... It is not copyable, and we should not be overload it's member operator. but we can inherit it.


英語の文法間違いは受け付けない--;
いや、まて何故韓国語じゃなくて英語で書いたんだ俺は?


追記:2007/05/03 ソースコード部分をはてな記法に修正。カテ分類