clase si obiecte in c++
DESCRIPTION
programare, clase, obiecte, c++TRANSCRIPT
-
1
Lab. 1
Clase i obiecte n C++
1. Obiective
Reluarea unor concepte din programarea obiectual: o clase, obiecte, membri o suprancrcarea operatorilor, motenirea simpl
2. Probleme rezolvate
Exemplul 1: Suprancrcarea operatorilor.
#include
using namespace std;
class complex{
private:
float re, im; public:
complex( ){}
complex(float x, float y)
{
re = x;
im = y;
}
void init(float x, float y)
{
re = x;
im = y;
} void arata( )
{
cout
-
2
STREAM
-
3
y = p.y;
cout
-
4
}
// destructor
Punct::~Punct( )
{
cout