c# constructor example programs
Example 1: c# constructor
public class Person
{
private string last;
private string first;
public Person(string lastName, string firstName)
{
last = lastName;
first = firstName;
}
// Remaining implementation of Person class.
}
Example 2: Constructor in C#
class Car
{
public Car(string Name, string Model, int Seat_Number, int Door_Number, double Price)
{
name = Name;
model = Model;
seat_Number = Seat_Number;
door_Number = Door_Number;
price = Price;
}
}