Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- class Punto
- {
- double x, y;
- public:
- Punto (double, double);
- ~Punto();
- Punto (const Punto &);
- double getX();
- double getY();
- double norma ();
- };
- Punto :: Punto(double xx, double yy) //costruttore
- {
- x= xx;
- y=yy;
- }
- Punto :: ~ Punto() //distruttore
- {
- cout <<"Chiamata al distruttore.\n"<< endl;
- }
- Punto:: Punto (const Punto &Punto) //costruttore di copia
- {
- y = Punto.y;
- x= Punto. x;
- }
- double Punto::getX() {
- return x;
- }
- double Punto::getY() {
- return y;
- }
- double Punto:: norma( double x, double y) {
- norma= (sqrt( x^2 + y^2));
- return norma;
- }
- int main()
- {
- cout << "Hello world!" << endl;
- Punto P(2, 5);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement