![MesExemples.com Image](http://cpp.mesexemples.com/wp-content/uploads/2011/12/candcplusplus.jpg)
{filelink=13221}
#include "stdafx.h"
using namespace System;
class Carre
{
public:
Int32 Surface()
{
return Dims * Dims;
}
Int32 Dims;
};
class Cube : public Carre // La classe Cube hérite les membres publique de la clsse Carree
{
public:
Int32 Volume()
{
return Surface() * Dims;
}
};
int main(void)
{
Cube *cube = new Cube();
cube->Dims = 6;
Console::WriteLine("Dimension= "+cube->Dims);
Console::WriteLine("Surafce= "+cube->Surface());
Console::WriteLine("Volume= "+cube->Volume());
Console::ReadLine();
return 0;
}