/*
 * Instituto Superior de Engenharia do Porto
 *
 * Estruturas de Informação
 *
 * 2000/2001
 *
 * ------------------------------------------
 *
 * demonstração conceitos genériocs sobre classes C++
 *		
 * x.cpp
 *
 */

#include "X.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CX::CX()
{
	setValor(0);
}

CX::CX(const CX& o)
{
	setValor(o.getValor());
}

CX::CX(int iV)
{
	setValor(iV);
}

CX::~CX()
{

}

////////////////////////////////////////////////////////////////////////
//	Set/Get
////////////////////////////////////////////////////////////////////////

int CX::getValor() const
{
	return m_iValor;
}

void CX::setValor(int iV)
{
	m_iValor = iV;
}

CX& CX::operator=(const CX& o)
{
	setValor(o.getValor());
	return *this;
}

////////////////////////////////////////////////////////////////////////
//	Operadores binários
////////////////////////////////////////////////////////////////////////

bool operator==(const CX& a, const CX& b)
{
	if (a.getValor() == b.getValor())
		return true;
	else
		return false;
}

CX operator+(const CX& a, const CX& b)
{
	CX c(a.getValor()+b.getValor());
	return c;
}
