Académique Documents
Professionnel Documents
Culture Documents
Se considera un numar de fisiere .h (corect) care contin descrieri de clase. Sa se genereze un fisier .out ce
contine ierarhia de clase gasita, reprezentata intr-o forma arborescenta. Se ignora comentariile si directivele
de preprocesare.
Exemplu
Intrare
/* punct.h */
#ifndef PUNCT
#define PUNCT
class CPunct
{
private:
int x, y;
public:
CPunct() {};
void SetX(int xx) {x = xx;}
void SetY(int yy) {y = yy;}
int GetX();
int GetY();
};
#endif
/* dreptunghi.h */
#include "punct.h"
class CDreptunghi : CPunct
{
private:
CPunct sus, jos;
public:
CDreptunghi() {}
void SetDreptunghi(CPunct sus, CPunct jos);
CPunct GetSus();
CPunct GetJos();
CPunct GetCentru();
};
/* cerc.h */
#include "punct.h"
class CCerc : CPunct
{
private:
CPunct centru;
int r;
public:
CCerc(){}
void SetCentru(CPunct c){centru = c;}
void SetRaza(int rr) {r = rr;}
};
/* poligon.h */
#include "punct.h"
#ifndef POLIGON
Iesire
CDreptunghi
CPunct
CCerc
CPunct
CPoliedru
CPoligon
CPunct
#define POLIGON
class CPoligon : CPunct
{
private:
CPunct p[100];
int nv;
public:
CPoligon(){}
void SetNV(int n);
void SetVf();
int GetNV();
};
#endif
/* poliedru.h */
#include "poligon.h"
class CPoliedru : CPoligon
{
public:
CPoligon* poli;
int nfete;
CPoliedru(){}
};