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 – class – objets

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



Complétez le code des 3 surcharges du constructeur de la classe Individu de telle manière que lorsque le programme de gauche s’exécute on obtienne l’affichage qui suit :

using System;
 class Individu 
 {
 public string nom;
 public string prenom;
 public int age;
 public Individu ( ……. )
 {
 }
 public Individu ( …….. )
 {
 }
 public Individu ( ………. ) : ………..
 {
 }
 }
 class Exercice
 {
 public static void Main( ) 
 {
 Individu personne_1, personne_2, personne_3;
 personne_1= new Individu ( );
 personne_1.nom="Vernes";
 personne_1.prenom="Jules";
 Console.WriteLine("identité  : "+personne_1.nom+", "+personne_1.prenom+", age : "+personne_1.age);
 personne_2= new Individu ("Hugo","Victor" );
 Console.WriteLine("identité  : "+personne_2.nom+", "+personne_2.prenom+", age : "+personne_2.age);
 personne_3= new Individu ("Dantes","Edmond" ,32);
 Console.WriteLine("identité  : "+personne_3.nom+", "+personne_3.prenom+", age : "+personne_3.age);
 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