#include <iostream.h>
#include "Constructori.h"

inline elem_lista::elem_lista(int valoare)
{
	val=valoare;
	urmatorul=NULL;
}

inline elem_lista::elem_lista(int valoare1, int valoare2)
{
	val=valoare1;
	urmatorul=new int(valoare2);
}

inline elem_lista::~elem_lista()
{
	if (urmatorul != NULL) delete urmatorul;
}


elem_lista::elem_lista(elem_lista& obiectsursa)
{
	this->val=obiectsursa.val;
	this->urmatorul=new int(*obiectsursa.urmatorul);
}

elem_lista& elem_lista::operator =(elem_lista operand)
{
	if (this!=&operand)
	{
		val=operand.val;
		*urmatorul=*operand.urmatorul;
	}
	return *this;
}


void elem_lista::afisez()
{
	if (urmatorul)
		cout << "\n val= " << val << " *urmatorul= " << *urmatorul 
		   << " urmatorul= " << hex << urmatorul;
	else
		cout << "\n val= " << val << " urmatorul= " 
         << hex << urmatorul;
}

void main()
{
	elem_lista element1(6,7), element2=element1, element3(5,6);
	cout << "\n val1= " << element1.val << " *urmatorul1= " 
		<< *element1.urmatorul << " urmatorul1= " << hex << element1.urmatorul;
	cout << "\n val2= " << element2.val << " *urmatorul2= " 
		<< *element2.urmatorul << " urmatorul2= " << hex << element2.urmatorul;
	element3=element1;
	cout << "\n val3= " << element3.val << " *urmatorul3= " 
		<< *element3.urmatorul << " urmatorul3= " << hex << element3.urmatorul;
	cout << "\n\n";
}
