ุงู„ู€ Constructor ู‡ูˆ ุนุจุงุฑุฉ ุนู† method ุฎุงุตุฉ ู…ูˆุฌูˆุฏุฉ ุฌูˆู‡ ุงู„ู€ classุŒ ูˆู…ุณุคูˆู„ุฉ ุนู† ุชุญุท ู‚ูŠู… ุฌูˆุง ุงู„ู€ Variables ุงู„ุฎุงุตุฉ ุจุงู„ูƒู„ุงุณ ุฏุง ูˆุจู†ู‚ูˆู„ ุนู„ูŠู‡ุง (initializing the variables). ุจูŠุชู… ุงุณุชุฏุนุงุก ูˆุจูŠุญุตู„ Call ุงู„ู€ constructor ุชู„ู‚ุงุฆูŠู‹ุง ุฃูˆู„ ู…ุง ุจู†ุนู…ู„ instance ุฃูˆ object ุฌุฏูŠุฏ ู…ู† ุงู„ูƒู„ุงุณ.

ุจูŠุชูƒูˆู† ู…ู† ุงูŠู‡ุŸ

Class Test
{
	// AccessModeifier ClassName(Parameter)
	public Test()
	{
	}
}
  • ุงู„ุงุณู…: ุงุณู… ุงู„ู€ constructor ู„ุงุฒู… ูŠูƒูˆู† ู‡ูˆ ู‡ูˆ ุจุงู„ุธุจุท ุงุณู… ุงู„ู€ class ุงู„ู„ูŠ ู‡ูˆ ู…ูˆุฌูˆุฏ ููŠู‡. ู…ุชู‚ุฏุฑุด ุชุบูŠุฑู‡.
  • ุงู„ู€ Return Type: ุงู„ู€ constructor ู…ุด ุจูŠุฑุฌุน ุฃูŠ ู‚ูŠู…ุฉุŒ ูˆุนุดุงู† ูƒุฏู‡ ู…ูŠู†ูุนุด ูŠูƒูˆู† ู„ู‡ ุฃูŠ return typeุŒ ุญุชู‰ void ุจุฑุถู‡ ู„ุฃ.
  • ุงู„ู€ Access Modifiers: ููŠ ุงู„ุนุงุฏุฉุŒ ุจูŠูƒูˆู† public ุนุดุงู† ู†ู‚ุฏุฑ ู†ุนู…ู„ objects ู…ู† ุงู„ูƒู„ุงุณ ููŠ ุฃูŠ ู…ูƒุงู†. ู„ูƒู† ู…ู…ูƒู† ูŠูƒูˆู† private ุฃูˆ protected ููŠ ุญุงู„ุงุช ุฎุงุตุฉ ุฒูŠ ุจุนุถ ุงู„ู€ Design Pattern.
  • ุงู„ุงุณุชุฎุฏุงู…: ุจู†ุฏูŠ ู‚ูŠู… ุงุจุชุฏุงุฆูŠุฉ ู„ู„ู€ fields ุฃูˆ ุงู„ู€ properties ุจุชุงุน ุงู„ูƒู„ุงุณ.

How Does it Work Without a Defined Constructor?

ู…ู…ูƒู† ุชุณุฃู„ ู†ูุณูƒ: ุฅุญู†ุง ุนู…ู„ู†ุง classes ู‚ุจู„ ูƒุฏู‡ ูˆู…ูƒุชุจู†ุงุด ููŠู‡ุง constructorุŒ ูˆู…ุน ุฐู„ูƒ ูƒู†ุง ุจู†ู‚ุฏุฑ ู†ุนู…ู„ object ุนุงุฏูŠ. ุฅุฒุงูŠ ุฏู‡ ุญุตู„ุŸ

ุงู„ุณุจุจ ู‡ูˆ ุฅู†ู‡ ู„ูˆ ุงู„ู…ุจุฑู…ุฌ ู…ุนุฑูุด ุฃูŠ constructor ุจู†ูุณู‡ุŒ ุงู„ู€ compiler ุจูŠุถูŠู ูˆุงุญุฏ ุชู„ู‚ุงุฆูŠ ูˆู‚ุช ุงู„ู€ compilation. ุงู„ู€ constructor ุฏู‡ ุจู†ุณู…ูŠู‡ Implicit Constructor (ุจูŽู†ู‘ูŽุงุก ุถู…ู†ูŠ).

graph LR
    subgraph Before Compilation
        A["class Test { int i;}"]
    end

    subgraph After Compilation by Compiler
        B["public Test()    i = 0; // Default initialization"]
    end

    A -->|"Compiler Adds"| B

ุงู„ู€ Implicit Constructor ุฏู‡ ุจูŠูƒูˆู† public ูˆู…ู† ุบูŠุฑ parameters (parameter-less)ุŒ ูˆูˆุธูŠูุชู‡ ุฅู†ู‡ ูŠุนู…ู„ ุชู‡ูŠุฆุฉ ู„ูƒู„ ู…ุชุบูŠุฑุงุช ุงู„ูƒู„ุงุณ ุจู‚ูŠู…ู‡ุง ุงู„ุงูุชุฑุงุถูŠุฉ (default values).

  • ุงู„ุฃู†ูˆุงุน ุงู„ุฑู‚ู…ูŠุฉ (int, long, float, double): 0
  • bool: false
  • string, object: null
  • char: '\0'

Why Do We Need to Define a Constructor Explicitly?

ุทุงู„ู…ุง ุงู„ู€ compiler ุจูŠุนู…ู„ ูˆุงุญุฏ ุจุงู„ู†ูŠุงุจุฉ ุนู†ู†ุงุŒ ุฅูŠู‡ ู„ุฒู…ุฉ ุฅู†ู†ุง ู†ูƒุชุจ constructor ุจู†ูุณู†ุง (explicitly)ุŸ

ุงู„ู…ุดูƒู„ุฉ ููŠ ุงู„ู€ Implicit Constructor (ุฃูˆ ุญุชู‰ ุงู„ู€ Default Constructor ุงู„ู„ูŠ ุจู†ุนู…ู„ู‡ ุจู‚ูŠู… ุซุงุจุชุฉ) ู‡ูŠ ุฅู†ู‡ ุจูŠุนู…ู„ ุชู‡ูŠุฆุฉ ู„ูƒู„ ุงู„ู€ objects ุจู†ูุณ ุงู„ู‚ูŠู….

ู…ุซุงู„:

class First
{
    public int x = 100;
}
 
class Test
{
    static void Main(string[] args)
    {
        First f1 = new First();
        First f2 = new First();
        First f3 = new First();
        // All objects will have x = 100
        Console.WriteLine($"{f1.x}, {f2.x}, {f3.x}"); // Output: 100, 100, 100
    }
}

ู‡ู†ุงุŒ ูƒู„ object ุจู†ุนู…ู„ู‡ ุจูŠุงุฎุฏ ู†ูุณ ุงู„ู‚ูŠู…ุฉ 100. ู„ูˆ ุนุงูŠุฒูŠู† ู†ุฏูŠ ู„ูƒู„ object ู‚ูŠู…ุฉ ู…ุฎุชู„ูุฉ ูˆู‚ุช ุฅู†ุดุงุฆู‡ุŒ ู‡ู†ุง ุจูŠุฌูŠ ุฏูˆุฑ ุงู„ู€ Explicit Parameterized Constructor. ุฏู‡ ุจูŠุณู…ุญู„ู†ุง ู†ู…ุฑุฑ ู‚ูŠู… ู…ุฎุชู„ูุฉ ู„ูƒู„ object ุจู†ุนู…ู„ู‡.

class Second
{
    public int x;
    // Explicit Parameterized Constructor
    public Second(int value)
    {
        this.x = value;
    }
}
 
class Test
{
    static void Main(string[] args)
    {
        // Now we can initialize each instance with a different value
        Second s1 = new Second(100); 
        Second s2 = new Second(200);
        Second s3 = new Second(300); 
        Console.WriteLine($"{s1.x}, {s2.x}, {s3.x}"); // Output: 100, 200, 300
    }
}

Types of Constructors

ููŠู‡ ุฎู…ุณ ุฃู†ูˆุงุน ุฑุฆูŠุณูŠุฉ ู…ู† ุงู„ู€ constructors ููŠ ู„ุบุฉ C#:

  1. Default (Parameter-less) Constructor
  2. Parameterized Constructor
  3. Copy Constructor
  4. Static Constructor
  5. Private Constructor

1. Default (Parameter-less) Constructor

ุฏู‡ ุงู„ู€ constructor ุงู„ู„ูŠ ู…ุด ุจูŠุงุฎุฏ ุฃูŠ parameters. ูˆู‡ูˆ ู†ูˆุนูŠู†:

  • ุงู„ู€ System-Defined Default Constructor: ุฏู‡ ุงู„ู„ูŠ ุงู„ู€ compiler ุจูŠุนู…ู„ู‡ ุชู„ู‚ุงุฆูŠู‹ุง ู„ูˆ ุฅู†ุช ู…ูƒุชุจุชุด ุฃูŠ constructor ุฎุงู„ุต. ุจูŠูƒูˆู† public ูˆุจูŠุนู…ู„ ุชู‡ูŠุฆุฉ ู„ู„ู…ุชุบูŠุฑุงุช ุจู‚ูŠู…ู‡ุง ุงู„ุงูุชุฑุงุถูŠุฉ.
  • ุงู„ู€ User-Defined Default Constructor: ุฏู‡ ุงู„ู„ูŠ ุฅู†ุช ุจุชูƒุชุจู‡ ุจู†ูุณูƒ ุจุณ ู…ู† ุบูŠุฑ parameters. ุจู†ุณุชุฎุฏู…ู‡ ุนุดุงู† ู†ุฏูŠ ู‚ูŠู… ุงุจุชุฏุงุฆูŠุฉ ุซุงุจุชุฉ ู„ูƒู„ ุงู„ู€ objects ุฃูˆ ู†ู†ูุฐ logic ู…ุนูŠู† ู…ุน ูƒู„ ุนู…ู„ูŠุฉ ุฅู†ุดุงุก.

ู…ุซุงู„ User-Defined:

class Employee
{
    public string Name;
    // User-Defined Default Constructor
    public Employee()
    {
        Name = "Default Employee";
    }
}

ุงู„ุนูŠุจ ููŠ ุงู„ู†ูˆุน ุฏู‡ ู‡ูˆ ุฅู† ูƒู„ ุงู„ู€ objects ุงู„ู„ูŠ ู‡ุชุนู…ู„ู‡ุง ู‡ุชุงุฎุฏ ู†ูุณ ุงู„ู‚ูŠู… ุงู„ุซุงุจุชุฉ.

2. Parameterized Constructor

ุฏู‡ ุงู„ู€ constructor ุงู„ู„ูŠ ุจูŠุงุฎุฏ parameters. ุจู†ุณุชุฎุฏู…ู‡ ุนุดุงู† ู†ู…ุฑุฑ ู‚ูŠู… ู…ุฎุชู„ูุฉ ู„ูƒู„ object ุจู†ุนู…ู„ู‡ุŒ ูˆุฏู‡ ุจูŠุฏูŠู†ุง ู…ุฑูˆู†ุฉ ุฃูƒุจุฑ.

class Employee
{
    public int Id;
    public string Name;
 
    // User Defined Parameterized Constructor
    public Employee(int id, string name)
    {
        this.Id = id;
        this.Name = name;
    }
}
 
// Usage
Employee emp1 = new Employee(101, "Ahmed");
Employee emp2 = new Employee(102, "Mona");

3. Copy Constructor

ุฏู‡ ู†ูˆุน ุฎุงุต ู…ู† ุงู„ู€ Parameterized Constructor ุจูŠุงุฎุฏ parameter ูˆุงุญุฏ ุจุณุŒ ุจูŠูƒูˆู† object ู…ู† ู†ูุณ ู†ูˆุน ุงู„ูƒู„ุงุณ. ูˆุธูŠูุชู‡ ุฅู†ู‡ ูŠู†ุณุฎ ุจูŠุงู†ุงุช object ู…ูˆุฌูˆุฏ ุจุงู„ูุนู„ ููŠ object ุฌุฏูŠุฏ. ุฏู‡ ู…ููŠุฏ ู„ูˆ ุนุงูŠุฒ ุชุนู…ู„ ู†ุณุฎุฉ ู…ู† object ู…ุนู‚ุฏ ู…ู† ุบูŠุฑ ู…ุง ุชุนูŠุฏ ุชู…ุฑูŠุฑ ูƒู„ ู‚ูŠู…ู‡ ู…ู† ุชุงู†ูŠ.

class Employee
{
    public int Id;
    public string Name;
 
    // Parameterized Constructor
    public Employee(int id, string name)
    {
        this.Id = id;
        this.Name = name;
    }
 
    // Copy Constructor
    public Employee(Employee empToCopy)
    {
        this.Id = empToCopy.Id;
        this.Name = empToCopy.Name;
    }
}
 
// Usage
Employee originalEmp = new Employee(101, "Ahmed");
// Create a new employee by copying data from the original
Employee copiedEmp = new Employee(originalEmp); 

4. Static Constructor

ุฏู‡ constructor ุจู†ุนุฑูู‡ ุจุงุณุชุฎุฏุงู… static modifierุŒ ูˆู„ู‡ ู‚ูˆุงุนุฏ ูˆุณู„ูˆูƒ ุฎุงุต ุฌุฏู‹ุง.

  • ู…ุณุคูˆู„ูŠุชู‡: ุจูŠุญุท ู‚ูŠู… ููŠ ุงู„ู€ static fields ุจุชุงุนุฉ ุงู„ูƒู„ุงุณุŒ ุฃูˆ ุชู†ููŠุฐ ุฃูŠ logic ู…ุญุชุงุฌ ูŠุดุชุบู„ ู…ุฑุฉ ูˆุงุญุฏุฉ ุจุณ ุนู„ู‰ ู…ุณุชูˆู‰ ุงู„ูƒู„ุงุณ ูƒู„ู‡.
  • ุงู„ุงุณุชุฏุนุงุก: ุจูŠุชู†ุงุฏู‰ ุจุดูƒู„ ุถู…ู†ูŠ (implicitly) ู…ุฑุฉ ูˆุงุญุฏุฉ ุจุณ ููŠ ุฏูˆุฑุฉ ุญูŠุงุฉ ุงู„ุชุทุจูŠู‚ (ูŠุนู†ูŠ ู„ู…ุง ู†ุดุบู„ ุงู„ุงุจู„ูƒูŠุดู† ูˆูŠู‚ูู„ ูุงู„ุงุฎุฑ ู‡ูŠ ุฏูŠ ุฏูˆุฑุฉ ุงู„ุญูŠุงุฉ).
  • ุชูˆู‚ูŠุช ุงู„ุชู†ููŠุฐ: ุจูŠุชู†ูุฐ ุชู„ู‚ุงุฆูŠู‹ุง ู‚ุจู„ ู…ุง ุชุนู…ู„ ุฃูˆู„ object ู…ู† ุงู„ูƒู„ุงุณุŒ ุฃูˆ ู‚ุจู„ ู…ุง ุชูˆุตู„ ู„ุฃูŠ member static (ู…ุชุบูŠุฑ ุฃูˆ method) ููŠ ุงู„ูƒู„ุงุณ ุฏู‡ ู„ุฃูˆู„ ู…ุฑุฉ. ู‡ูˆ ุฃูˆู„ ุญุงุฌุฉ ุจุชุชู†ูุฐ ููŠ ุงู„ูƒู„ุงุณ.
  • ู‚ูˆุงุนุฏู‡:
    • ู…ูŠู†ูุนุด ูŠุงุฎุฏ ุฃูŠ access modifiers (ู„ุง public ูˆู„ุง private).
    • ู„ุงุฒู… ูŠูƒูˆู† ู…ู† ุบูŠุฑ parameters.
    • ู…ูŠู†ูุนุด ู†ุณุชุฏุนูŠู‡ ุจู†ูุณู†ุง ุจุดูƒู„ ุตุฑูŠุญ.
    • ู…ูŠู†ูุนุด ู†ุนู…ู„ู‡ overloadingุŒ ูˆู…ู…ูƒู† ูŠูƒูˆู† ููŠู‡ ูˆุงุญุฏ ุจุณ ููŠ ุงู„ูƒู„ุงุณ.
    • ุจูŠู‚ุฏุฑ ูŠูˆุตู„ ู„ู„ู€ static members ุจุณ.
public class DatabaseConnection
{
    // Static Constructor
    static DatabaseConnection()
    {
        Console.WriteLine("Static Constructor Executed: Initializing database connection settings...");
    }
 
    // Instance Constructor
    public DatabaseConnection()
    {
        Console.WriteLine("Instance Constructor Executed.");
    }
}
 
class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Main method started.");
        // Static constructor runs here, before the first instance is created
        DatabaseConnection conn1 = new DatabaseConnection();
        DatabaseConnection conn2 = new DatabaseConnection();
        Console.WriteLine("Main method finished.");
    }
}

Output:

Main method started.
Static Constructor Executed: Initializing database connection settings...
Instance Constructor Executed.
Instance Constructor Executed.
Main method finished.

5. Private Constructor

ุฏู‡ constructor ุจู†ุนุฑูู‡ ุจุงุณุชุฎุฏุงู… private access modifier.

  • ุชุฃุซูŠุฑู‡ ุงู„ุฃุณุงุณูŠ: ุจูŠู…ู†ุน ุงู†ู†ุง ู†ุนู…ู„ object ู…ู† ุงู„ูƒู„ุงุณ ุฏู‡ ู…ู† ุจุฑู‡ ุงู„ูƒู„ุงุณ. ู„ูƒู† ู†ู‚ุฏุฑ ู†ุนู…ู„ objects ุฌูˆู‡ ู†ูุณ ุงู„ูƒู„ุงุณ ุนุงุฏูŠ.
  • ุงู„ูˆุฑุงุซุฉ: ู…ุด ุจูŠู…ู†ุน ุงู„ูˆุฑุงุซุฉ ุจุดูƒู„ ู…ุทู„ู‚. ู„ูˆ ููŠู‡ public constructor ุชุงู†ูŠุŒ ู…ู…ูƒู† ุชูˆุฑุซ ุงู„ูƒู„ุงุณ. ู„ูƒู† ู„ูˆ ูƒู„ ุงู„ู€ constructors ุงู„ู„ูŠ ููŠู‡ privateุŒ ุณุงุนุชู‡ุง ู…ุด ู‡ุชู‚ุฏุฑ ุชูˆุฑุซู‡ ู…ู† ูƒู„ุงุณ ุฎุงุฑุฌูŠ. ู„ูˆ ุนุงูŠุฒ ุชู…ู†ุน ุงู„ูˆุฑุงุซุฉ ุชู…ุงู…ู‹ุงุŒ ุงุณุชุฎุฏู… sealed class.
  • ุงู„ุงุณุชุฎุฏุงู… ุงู„ุฃุดู‡ุฑ: ุชุทุจูŠู‚ ุงู„ู€ Singleton Design PatternุŒ ูˆู‡ูˆ ู†ู…ุท ุจูŠุถู…ู† ุฅู†ูƒ ุชุนู…ู„ object ูˆุงุญุฏ ุจุณ ู…ู† ุงู„ูƒู„ุงุณ ุฏู‡ ุนู„ู‰ ู…ุณุชูˆู‰ ุงู„ุชุทุจูŠู‚ ูƒู„ู‡.
public sealed class Singleton
{
    private static Singleton _instance = null;
    private static int counter = 0;
 
    // The private constructor prevents creating instances from outside
    private Singleton()
    {
        counter++;
        Console.WriteLine($"Singleton instance created. Counter: {counter}");
    }
 
    public static Singleton GetInstance()
    {
        if (_instance == null)
        {
            _instance = new Singleton();
        }
        return _instance;
    }
}

Advanced Concepts

Constructor Overloading

ุงู„ู€ Overloading ู…ุนู†ุงู‡ ุฅู†ูƒ ูŠูƒูˆู† ุนู†ุฏูƒ ุฃูƒุชุฑ ู…ู† constructor ููŠ ู†ูุณ ุงู„ูƒู„ุงุณุŒ ูƒู„ ูˆุงุญุฏ ู„ู‡ signature ู…ุฎุชู„ูุฉ (ูŠุนู†ูŠ ุนุฏุฏ ุฃูˆ ู†ูˆุน ุฃูˆ ุชุฑุชูŠุจ ุงู„ู€ parameters ู…ุฎุชู„ู).

ูˆุฏุง ู†ูˆุน ู…ู† ุงู†ูˆุงุน ุงู„ู€ Method Overloading ุงู„ู„ูŠ ู‡ูˆ ุนุจุงุฑุฉ ุนู† Compile-time Polymorphism

public class Car 
{
	// Overloaded constructors
	public Car () { Console.WriteLine("Default car created."); }
	public Car (string model) { Console.WriteLine($"{model} created."); }
	public Car (string model, int year) { Console.WriteLine($"{model} from {year} created."); }
}

Constructor Chaining

ุฃุญูŠุงู†ู‹ุง ุจูŠูƒูˆู† ุนู†ุฏูƒ ูƒูˆุฏ ู…ูƒุฑุฑ ููŠ ุฃูƒุชุฑ ู…ู† constructor. ุนุดุงู† ุชุชุฌู†ุจ ุงู„ุชูƒุฑุงุฑ ุฏู‡ ูˆุชุฎู„ูŠ ูƒูˆุฏูƒ ุฃู†ุถูุŒ ู…ู…ูƒู† ุชุณุชุฎุฏู… Constructor ChainingุŒ ูˆุฏู‡ ู…ุนู†ุงู‡ ุฅู† constructor ูŠู†ุงุฏูŠ ุนู„ู‰ constructor ุชุงู†ูŠ ููŠ ู†ูุณ ุงู„ูƒู„ุงุณ. ุจู†ุนู…ู„ ุฏู‡ ุจุงุณุชุฎุฏุงู… ูƒู„ู…ุฉ this.

public class Customer
{
    public List<Order> Orders;
    public int ID;
    public string Name;
 
    // 1. Default constructor initializes the list
    public Customer()
    {
        Orders = new List<Order>();
    }
    
    // 2. This constructor calls the default one first using ': this()'
    public Customer(int id)
        : this() 
    {
        this.ID = id;
    }
 
    // 3. This constructor calls the one with the 'id' parameter first
    public Customer(int id, string name)
        : this(id)
    {
        // By the time this code runs, the list is initialized and the ID is set.
        this.Name = name;
    }
}

ู…ู„ุญูˆุธุฉ: ุงู„ู€ constructor ุงู„ู„ูŠ ุจู†ุนู…ู„ู‡ chain ุจูŠุชู†ูุฐ ุงู„ุฃูˆู„ุŒ ูˆุจุนุฏูŠู† ุงู„ูƒูˆุฏ ุงู„ู„ูŠ ุฌูˆู‡ ุงู„ู€ constructor ุงู„ุญุงู„ูŠ ุจูŠุชู†ูุฐ.

Important Distinctions

Struct vs. Class Constructors

  • ุงู„ู€ Class: ุงู„ู€ default constructor (ุงู„ุถู…ู†ูŠ) ุจูŠุชุนู…ู„ ุจุณ ู„ูˆ ุฃู†ุช ู…ุนู…ู„ุชุด ุฃูŠ constructor ุจู†ูุณูƒ. ู„ูˆ ุนู…ู„ุช ูˆุงุญุฏุŒ ุงู„ุงูุชุฑุงุถูŠ ุจูŠุชู„ุบูŠ.
  • ุงู„ู€ Struct: ุงู„ู€ default constructor ุจูŠุชุนู…ู„ ุฏุงูŠู…ู‹ุง ูˆู…ุชู‚ุฏุฑุด ุชู…ู†ุนู‡ ุฃูˆ ุชุบูŠุฑู‡. ู„ูˆ ุนู…ู„ุช constructor ุจู€ parametersุŒ ู„ุงุฒู… ุชุนู…ู„ initialize ู„ูƒู„ ุงู„ู€ fields ุงู„ู„ูŠ ุฌูˆู‡ ุงู„ู€ struct.

Static vs. Non-Static Constructors

ุงู„ู…ูŠุฒุฉStatic ConstructorNon-Static (Instance) Constructor
ุงู„ุชุนุฑูŠูุจูŠุณุชุฎุฏู… static modifierู…ุด ุจูŠุณุชุฎุฏู… static modifier
ุงู„ู…ุณุคูˆู„ูŠุฉุจู†ุญุท ู‚ูŠู… ููŠ ุงู„ู€ static dataุจู†ุญุท ู‚ูŠู… ููŠ ุงู„ู€ non-static (instance) data
ุงู„ุงุณุชุฏุนุงุกุถู…ู†ูŠ (Implicit)ุตุฑูŠุญ (Explicit)
ุนุฏุฏ ู…ุฑุงุช ุงู„ุชู†ููŠุฐู…ุฑุฉ ูˆุงุญุฏุฉ ุจุณุตูุฑ ุฃูˆ ุฃูƒุชุฑ (ู…ุน ูƒู„ instance ุฌุฏูŠุฏ)
ุงู„ู€ Parametersู…ูŠู†ูุนุด ูŠุงุฎุฏ parametersู…ู…ูƒู† ูŠุงุฎุฏ parameters
ุงู„ู€ Overloadingู…ูŠู†ูุนุด ู†ุนู…ู„ู‡ overloadingู…ู…ูƒู† ู†ุนู…ู„ู‡ overloading
ุงู„ู€ Access Modifierู…ูŠู†ูุนุด ูŠุงุฎุฏ ุฃูŠ access modifierู…ู…ูƒู† ูŠุงุฎุฏ ุฃูŠ access modifier (public, private, etc.)