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 – paramètres

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



paramètres Complétez et corrigez le programme de gauche, de telle façon que l’appel objA.methode1( a, b, c ) soit compilé et exécuté correctement.

using System;
 class classeA
 {
 public void methode1( int x, out int y, ref int z ) 
 {
 x=100;
 y=100;
 z=100;
 Console.WriteLine("dans methode1 : a  = "+x+", b = "+y+", c = "+z);
 }
 }
 class Exercice
 {
 public static void Main( ) 
 {
 int a=10, b=a, c=b ;
 classeA objA = new classeA( ) ;
 Console.WriteLine( "avant appel : a  = "+a+", b = "+b+", c = "+c );
 objA.methode1( a, b, c ); // erreurs signalées ici
 Console.WriteLine( "après appel : a  = "+a+", b = "+b+", c = "+c );
 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