repl.it
@kironroy/

methodoverloading

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
  • notes.txt
main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;

namespace MethodOverloading
 {
   
   class Printdata {
      void print(int integerValue) {
         Console.WriteLine($"Printing integer: {integerValue}" );
      }
      void print(double floatValue) {
         Console.WriteLine($"Printing float vlaue: {floatValue}" );
      }
      void print(string stringValue) {
         Console.WriteLine($"Printing string: {stringValue}" );
      }
      static void Main(string[] args) {
         Printdata p = new Printdata();
         
         // Call print to print integer
         p.print(5);
         
         // Call print to print float
         p.print(500.263);
         
         // Call print to print string
         p.print("Hello C++, I mean C#");
         Console.ReadKey();
      }
   }
}