Les propriétés virtuelles

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

upscmp Source=virtuel2.upl

Revenir en haut de la page...

virtuel2

Revenir en haut de la page...

Source Composant "Exemple de propriétés virtuelles" Version 1.0.0;

Public :
Type TA
/*****/
Public : Protege : UL> A2 : Booleen Virtuel;
B2 : Entier Virtuel;
C2 : Reel Virtuel;
D2 : Caractere Virtuel;
Prive : Public : Fin Type

Public :
Procedure TA.A1(P : Booleen)
/************************/ Debut
A1Bis=P;
Fin Procedure

Fonction TA.A1() Retourner Booleen
/********************************/
Debut
Retourner A1Bis;
Fin Fonction

Procedure TA.B1(P : Entier)
/***********************/
Debut
B1Bis=P;
Fin Procedure

Fonction TA.B1() Retourner Entier
/*******************************/
Debut
Retourner B1Bis;
Fin Fonction

Procedure TA.C1(P : Reel)
/*********************/
Debut
C1Bis=P;
Fin Procedure

Fonction TA.C1() Retourner Reel
/*****************************/
Debut
Retourner C1Bis;
Fin Fonction

Procedure TA.D1(P : Caractere)
/**************************/
Debut
D1Bis=P;
Fin Procedure

Fonction TA.D1() Retourner Caractere
/**********************************/
Debut
Retourner D1Bis;
Fin Fonction

Protege :
Procedure TA.A2(P : Booleen)
/************************/
Debut
A2Bis=P;
Fin Procedure

Fonction TA.A2() Retourner Booleen
/********************************/
Debut
Retourner A2Bis;
Fin Fonction

Procedure TA.B2(P : Entier)
/***********************/
Debut
B2Bis=P;
Fin Procedure

Fonction TA.B2() Retourner Entier
/*******************************/
Debut
Retourner B2Bis;
Fin Fonction

Procedure TA.C2(P : Reel)
/*********************/
Debut
C2Bis=P;
Fin Procedure

Fonction TA.C2() Retourner Reel
/*****************************/
Debut
Retourner C2Bis;
Fin Fonction

Procedure TA.D2(P : Caractere)
/**************************/
Debut
D2Bis=P;
Fin Procedure

Fonction TA.D2() Retourner Caractere
/**********************************/
Debut
Retourner D2Bis;
Fin Fonction

Public :
Procedure TA.Afficher()
/*********************/
Debut Ecran.Ecrire("A1=");
Ecran.Ecrire(A1);
Ecran.Ecrire("B1=");
Ecran.Ecrire(B1);
Ecran.Ecrire("C1=");
Ecran.Ecrire(C1);
Ecran.Ecrire("D1=");
Ecran.Ecrire(D1);
Ecran.Ecrire("A2=");
Ecran.Ecrire(A2);
Ecran.Ecrire("B2=");
Ecran.Ecrire(B2);
Ecran.Ecrire("C2=");
Ecran.Ecrire(C2);
Ecran.Ecrire("D2=");
Ecran.Ecrire(D2);
Ecran.Ecrire("\n");
Fin Procedure

Procedure Passage(P1 : Booleen Entree Sortie, P2 : Entier Entree Sortie, P3 : Reel Entree Sortie, P4 : Caractere Entree Sortie)
/******************************************************************/
Debut Ecran.Ecrire("P1=");
Ecran.Ecrire(P1);
Ecran.Ecrire("P2=");
Ecran.Ecrire(P2);
Ecran.Ecrire("P3=");
Ecran.Ecrire(P3);
Ecran.Ecrire("P4=");
Ecran.Ecrire(P4);
Ecran.Ecrire("\n");
P1=Faux;
P2=1515;
P3=2.71;
P4="schuss";
Fin Procedure

Principal
/*******/
Variable Debut
VA.A1=Vrai;
VA.B1=1;
VA.C1=2.0;
VA.D1="coucou";
VA.Afficher();

Passage(VA.A1,VA.B1,VA.C1,VA.D1);
VA.Afficher();

VA.B1=0;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1+=10;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1-=8;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1*=10;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1/=10;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1%=2;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1&=255;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1|=255;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1<<=2;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
VA.B1>>=2;
Ecran.Ecrire("VA.B1=");
Ecran.Ecrire(VA.B1);
Ecran.Ecrire("\n");

VA.B1=0;
Ecran.Ecrire("++VA.B1=");
Ecran.Ecrire(++VA.B1);
Ecran.Ecrire("--VA.B1=");
Ecran.Ecrire(--VA.B1);
Ecran.Ecrire("VA.B1++=");
Ecran.Ecrire(VA.B1++);
Ecran.Ecrire("VA.B1--=");
Ecran.Ecrire(VA.B1++);
Ecran.Ecrire("\n");
VA.D1+="aaa";
Ecran.Ecrire("VA.D1=");
Ecran.Ecrire(VA.D1);
Fin Principal

Revenir en haut de la page...