C# 'this' using help pls
I have no idea what happens there, if could you explain me what is this code doing step by step it would be nice. Input give us 2 values type of double, and i think this line: Avg avg = new Avg(num1, num2); is meaning that we pass num1 and num2 to the Avg class by constructor and 'this.' is assigning them to the declared variables inside class ? class Program { static void Main(string[] args) { double num1 = Convert.ToDouble(Console.ReadLine()); double num2 = Convert.ToDouble(Console.ReadLine()); Avg avg = new Avg(num1, num2); Console.WriteLine(avg.GetAvg()); } } class Avg { double num1; double num2; //create the constructor public Avg(double num1,double num2 ) { this.num1 = num1; this.num2 = num2; } public double GetAvg() { return (num1 + num2)/2; } } }