repl.it
@kironroy/

methodoverloading2

C#

No description

fork
loading
Files
  • main.cs
  • main.exe
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System;

namespace MethodOverload
{
    class Program
    {
        static void Main(string[] args)
        {
   
            // control shift space shows method overloads
            var employee = new EmployeeModel();
            var employeeEmail = employee.EmployeeInfoPrinted("[email protected]");
            var employeeFullInfo = employee.EmployeeInfoPrinted("Grace", "Kelly", "1232");

            Breakline();
            Console.WriteLine(employeeFullInfo);
            Console.WriteLine(employeeEmail);
            Breakline();
       
            Console.ReadLine();

            
        }

        static void Breakline()
        {
            Console.WriteLine();
            Console.WriteLine("-----------------------------");
            Console.WriteLine();
        }


    }

    public class EmployeeModel
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string EmployeeID { get; set; }
        public string Email { get; set; }

        public EmployeeModel()
        {
                
        }

        public EmployeeModel(string email)
        {
            Email = email;
        }

        public EmployeeModel(string firstName, string lastName, string employeeID)
        {
            FirstName = firstName;
            LastName = lastName;
            EmployeeID = employeeID;
        }

        public string EmployeeInfoPrinted(string firstName, string lastName, string employeeID)
        {
            return $"Employee full name is: {firstName} {lastName} and employee id is: {employeeID}"; 
        }

        public string EmployeeInfoPrinted(string email)
        {
            return $"Employee email is: {email}";
        }

    }

}