Les variables de types Fonction et Procedure

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

upscmp Source=ptrappel.upl

Revenir en haut de la page...

ptrappel

Revenir en haut de la page...

Source Composant "Exemple d'emploi des variables de type Procedure ou Fonction" Version 1.0.0;

Type T
/****/ Fin Type

Type T2 >HeriteDe T
/****************/
Constructeur();
Fin Type

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

Procedure P2(AA : Caractere)
/************************/
Debut
Ecran.Ecrire("P2()");
Ecran.Ecrire(AA);
Fin Procedure

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

Procedure P4(AA : Entier Entree Sortie, BB : Reel Entree Sortie, CC : Caractere Entree Sortie)
/**************************************************************************************/
Debut
Ecran.Ecrire("P4()");
Ecran.Ecrire(AA);
Ecran.Ecrire(BB);
Ecran.Ecrire(CC);
AA=2;
BB=3.14;
CC="hello";
Fin Procedure

Fonction F1() Retourner Booleen
/****************************/
Debut
Ecran.Ecrire("F1()");
Retourner Vrai;
Fin Fonction

Fonction F2() Retourner Entier
/****************************/
Debut
Ecran.Ecrire("F2()");
Retourner 1;
Fin Fonction

Fonction F3() Retourner Reel
/**************************/
Debut
Ecran.Ecrire("F3()");
Retourner 10.2;
Fin Fonction

Fonction F4(AA : Caractere) Retourner Caractere
/*******************************************/
Debut
Ecran.Ecrire("F4()");
Ecran.Ecrire(AA);
Retourner "coucou";<
Fin Fonction

Constructeur T()
/**************/
Debut
Fin Constructeur

Procedure T.TP1()
/***************/
Debut
Ecran.Ecrire("T.TP1()");
Fin Procedure

Procedure T.TP2(AA : Caractere)
/***************************/
Debut
Ecran.Ecrire("T.TP2()");
Ecran.Ecrire(AA);
Fin Procedure

Fonction T.TF1() Retourner Booleen
/********************************/
Debut
Ecran.Ecrire("T.TF1()");
Retourner Vrai;
Fin Fonction

Fonction T.TF2() Retourner Entier
/*******************************/
Debut
Ecran.Ecrire("T.TF2()");
Retourner 1;
Fin Fonction

Fonction T.TF3() Retourner Reel
/*****************************/
Debut
Ecran.Ecrire("T.TF3()");
Retourner 10.2;
Fin Fonction

Fonction T.TF4(P : Caractere) Retourner Caractere
/**********************************************/
Debut
Ecran.Ecrire("F4()");
Ecran.Ecrire(AA);
Retourner "coucou";
Fin Fonction

Constructeur T2()
/***************/
Debut
Fin Constructeur

Principal
/*******/
Debut
A=P1;
A();
B=P2;
B("bonjour");
C=F1;
G=C();
Ecran.Ecrire(G);
D=F2;
H=D();
Ecran.Ecrire(H);
E=F3;
I=E();
Ecran.Ecrire(I);
F=F4;
J=F("bonjour");
Ecran.Ecrire(J);
Ecran.Ecrire("\n");

A=O.TP1;
A();
B=O.TP2;
B("bonjour");
C=O.TF1;
G=C();
Ecran.Ecrire(G);
D=O.TF2;
H=D();
Ecran.Ecrire(H);
E=O.TF3;
I=E();
Ecran.Ecrire(I);
F=O.TF4;
J=F("bonjour");
Ecran.Ecrire(J);
Ecran.Ecrire("\n");

K=P4;
H=1;
I=2.71;
J="bonjour";
K(H, I, J);
Ecran.Ecrire(H);
Ecran.Ecrire(I);
Ecran.Ecrire(J);
A=O2.TP1;
A();
Ecran.Ecrire("\n");

A2=P3;
Si A2==A Alors Sinon Fin Si
Si A2!=A Alors Sinon Fin Si
A2=A;
A2();
Fin Principal

Revenir en haut de la page...