HERENCIA

8

Click here to load reader

description

HERENCIA

Transcript of HERENCIA

/*HERENCIA.PROBLEMA 01:*/"stdafx.h"#include using namespace std;class Punto {// atributosprotected:double x, y;public:// funcionalidad basicadouble getX(){return x;}void setX(double nx) {x=nx;}double getY(){return y;}void setY(double ny){y=ny;}// funcionalidad adicionaldouble distancia(){ return sqrt(x*x+y*y); }void lee(){coutx;couty;}};// aplica herenciaclass Punto3D : public Punto{// atributosprotected:double z;public:double getZ(){ return z;}void setZ(double nz){ z = nz;}double distancia(){return sqrt(pow(getX(),2)+pow(y,2) + pow(z,2));}void lee(){Punto::lee();cout z;}void imprime(){cout