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

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



Remplacez les ……. dans le programme de gauche de telle façon que l’exécution affiche :

methode1- virtual  - classeA
methode1- virtual  - classeB
methode1- static  - classeB

Expliquez commment la classeB peut posséder 3 méthodes de même nom methode1( ).

using System;
 class classeA
 {
 public virtual void methode1( ) 
 {
 Console.WriteLine("methode1- virtual  - classeA");
 }
 }
 class classeB : classeA 
 {
 public …….. void methode1(char x )
 {
 Console.WriteLine("methode1- virtual  - classeB  ");
 }
 public …….. void methode1(int x ) 
 {
 Console.WriteLine("methode1- static  - classeB ");
 }
 }
 class Exercice
 {
 public static void Main( ) 
 {
 classeB obj = new classeB();
 obj.methode1( );
 obj.methode1( 'a' );
 classeB.methode1( 45 );
 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