Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

TQ – tableaux

Thèmes des Questions – C# (C Sharp)



tableaux Expliquez l’affichage ci-dessous produit par le programme de gauche :

using System;
 class classeA
 {
 public string[ ] table1 =
 {
 "aa","bb","cc","dd","ee"
 };
 public string[ ] table2 =
 {
 "11","22","33","44","55"
 };
 public void afficher( ) 
 {
 Console.Write("table1 = " );
 foreach(string s in table1)
 Console.Write(s+", ");
 Console.Write("\ntable2 = " );
 foreach(string s in table2)
 Console.Write(s+", ");
 Console.WriteLine( );
 }
 public void modifier1(string[] T ) 
 {
 T=table2;
 T[2] = "xxx";
 }
 public void modifier2(ref string[] T ) 
 {
 T=table2;
 T[2] = "xxx";
 }
 }
 class Exercice
 {
 public static void Main( ) 
 {
 classeA objA = new classeA( );
 Console.WriteLine("Avant toute modifications : ");
 objA.afficher();
 Console.WriteLine("\nobjA.modifier1(objA.table1) : ");
 objA.modifier1(objA.table1);
 objA.afficher();
 Console.WriteLine("\nobjA.modifier2(ref objA.table1) : ");
 objA.modifier2(ref objA.table1);
 objA.afficher();
 Console.ReadLine( );
 }
 }

Comments are closed, but trackbacks and pingbacks are open.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More