#include <iostream.h>
#include "Base1.hpp"

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

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

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

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

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

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

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

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

istream & operator >>(istream &In, Base1 &B)
{
    cerr << "Operatorul de extractie prieten al clasei de baza Base1." << 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, Base1 const &B)
{
    cerr << "Operatorul de insertie prieten al clasei de baza Base1" << endl;
    Out << "x : " << B.x << endl << "y : " << B.y << endl;
#if defined(_DEBUG_)
    cerr << "Apasati enter";
    cin.get();
#endif
    return Out;
}

