Les héritages de types

Commande de compilation...
Commande d'exécution...
Fichier source...

upscmp Source=heritede.upl

Revenir en haut de la page...

heritede

Revenir en haut de la page...

Source Composant "Exemple d'héritages" Version 1.0.0;

Public :
Type TA
/*****/
Public : Fin Type

Type TB HeriteDe TA
/*****************/
Public : Fin Type

Type TC
/*****/
Public : Fin Type

Type TD HeriteDe TA, TC
/*********************/
Public : Fin Type

Constructeur TA()
/***************/
Debut
A=Vrai;
B="Objet TA";
Fin Constructeur

Procedure TA.P1()
/***************/
Debut
Ecran.Ecrire("TA.P1");
Fin Procedure

Procedure TA.P2(P : Caractere)
/**************************/
Debut
Ecran.Ecrire("TA.P2");
B=P;
Fin Procedure

Constructeur TB()
/***************/
Debut
C=10;
D=11;
Fin Constructeur

Procedure TB.P1()
/***************/
Debut
Ecran.Ecrire("TB.P1");
Fin Procedure

Procedure TB.P3(P : Caractere)
/**************************/
Debut Ecran.Ecrire("TB.P3");
B=P;
Fin Procedure

Constructeur TC()
/***************/
Debut
E=10.2;
F=2.1;
Fin Constructeur

Procedure TC.P4()
/***************/
Debut
Ecran.Ecrire("TC.P4");
Fin Procedure

Constructeur TD()
/***************/
Debut
G="Objet TC";
Fin Constructeur

Procedure TD.P4()
/***************/
Debut
Ecran.Ecrire("TD.P4");
Fin Procedure

Principal
/*******/ Variable Debut
Ecran.Ecrire(VA.B);
Ecran.Ecrire(VB.B);
Ecran.Ecrire(VC.E);
Ecran.Ecrire(VD.B);
Ecran.Ecrire(VD.E);
Ecran.Ecrire("\n");

VA.P1();
VA.P2("coucou");
Ecran.Ecrire(VA.B);
Ecran.Ecrire("\n");

VB.P1();
> VB.P2("coucou");
Ecran.Ecrire(VB.B);
VB.P3("bonjour");
Ecran.Ecrire(VB.B);
VB.P1.Super();
Ecran.Ecrire("\n");

VC.P4();
Ecran.Ecrire("\n");

VD.P1();
VD.P2("hello");
Ecran.Ecrire(VD.B);
VD.P4();
VD.P4.Super();
Fin Principal

Revenir en haut de la page...