#include <iostream.h>

#include "Base2.hpp"

Base2::Base2(void) : x(0), y(0)
{
    cerr << "Base2 : constructor implicit." << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
}

Base2::Base2(Base2 const & B) : x(B.x), y(B.y)
{
    cerr << "Base2 : constructor de copiere." << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
}

Base2::Base2(int Vx, int Vy) : x(Vx), y(Vy)
{
    cerr << "Base2 : constructor cu parametri." << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
}

virtual Base2::~Base2()
{
    cerr << "Base2 : destructor." << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
}

Base2 & Base2::operator =(Base2 const &B)
{
    cerr << "Base2 : operator de atribuire." << endl;
    x = B.x;
    y = B.y;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
    return *this;
}

Base2 Base2::operator +(Base2 const &B) const
{
    cerr << "Base2 : operator de adunare." << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
    return Base2(x + B.x, y + B.y);
}

virtual int Base2::operator ()(int ValInt)
{
    cerr << "Base2 : operatorul virtual ()" << endl;
    return (x + y) * ValInt;
}

int Base2::operator ()(int Val1, int Val2)
{
    cerr << "Base2 : operatorul ()" << endl;
    return x * Val1 + y * Val2;
}

istream & operator >>(istream &In, Base2 &B)
{
    cerr << "Operatorul de extractie prieten al clasei de baza Base2." << endl;
    cerr << "x : ";
    In >> B.x;
    cerr << "y : ";
    In >> B.y;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
    return In;
}

ostream & operator <<(ostream &Out, Base2 const &B)
{
    cerr << "Operatorul de insertie prieten al clasei de baza Base2" << endl;
    Out << "x : " << B.x << endl << "y : " << B.y << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
    return Out;
}

