using System; | |
namespace MyLibrary | |
{ | |
public class Employee | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public bool IsFullTime { get; set; } | |
public Employee(string firstName, string lastName, bool isFullTime = true) | |
{ | |
Console.WriteLine("Inside Employee constructor. isFullTime should default to true."); | |
FirstName = firstName; | |
LastName = lastName; | |
IsFullTime = isFullTime; | |
} | |
} | |
} |
using System; | |
namespace MyLibrary | |
{ | |
public class Employee | |
{ | |
public string FirstName { get; set; } | |
public string LastName { get; set; } | |
public bool IsFullTime { get; set; } | |
public Employee(string firstName, string lastName, bool isFullTime = false) | |
{ | |
FirstName = firstName; | |
LastName = lastName; | |
IsFullTime = isFullTime; | |
} | |
} | |
} |
using MyLibrary; | |
using System; | |
namespace MyApp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var employee = new Employee("Jane", "Doe"); // Use the default parameter | |
Console.WriteLine($"Name: {employee.FirstName} {employee.LastName}; Full Time: {employee.IsFullTime}"); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment