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 – accesseurs

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



Le programme de gauche ne compile pas correctement, le compilateur décèle trois erreurs. En rappelant les propriétés des différents accesseurs de visibilité de C#, éliminez les instructions incriminées.

Essayez de trouver les erreurs tout seul, et de n’utiliser le compilateur que pour vérifier vos solutions.

using System;
 class classeA
 {
 private int  x = 100;
 protected internal int  y = 100;
 internal int  z = 100;
 protected int  t = 100;
 public int  u = 100;
 }
 class classeB : classeA
 {
 public void testAcces( ) 
 {
 Console.WriteLine( x );
 Console.WriteLine( y );
 Console.WriteLine( z );
 Console.WriteLine( t );
 Console.WriteLine( u );
 }
 }
 class Exercice
 {
 public static void Main( ) 
 {
 classeA obj = new classeA( );
 Console.WriteLine( obj.x );
 Console.WriteLine( obj.y );
 Console.WriteLine( obj.z );
 Console.WriteLine( obj.t );
 Console.WriteLine( obj.u );
 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