Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- En ClasePrueba.cpp:
- #include "ClasePrueba.h"
- //Constructor
- TClase::TClase()
- {
- Int = new TInt();
- }
- //Destructor
- TClase::~TClase()
- {
- delete Int;
- }
- //Constructor
- TInt::TInt()
- {
- valor = &TClase::I;
- }
- //Destructor
- TInt::~TInt()
- {
- }
- //Metodo de la clase
- AnsiString __fastcall TInt::toHex(int value)
- {
- *valor = value;
- return AnsiString().sprintf("0x%s",AnsiString().IntToHex(*valor ,8));
- }
- En ClasePrueba.h:
- class TInt
- {
- public:
- TInt();
- ~TInt();
- AnsiString __fastcall toHex(int value);
- private:
- int TClase::*valor;
- };
- class TClase
- {
- friend class TInt;
- private:
- int I; //Variable privada
- public:
- TClase();
- ~TClase();
- TInt *Int;
- };
- //---------------------------------------------------------------------------
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement