I am writing a program that calculates the C side of a triangle using Pythagoras' theorem. I have to use a class.
Why does it give 0 as an answer with the following code: What is the solution:
code in class:
    public class Pyt
    {
        public Pyt(double rh1, double rh2, double _Som, double _Som2)
        {
            _Rh1 = rh1;
            _Rh2 = rh2;
        }
        public double _Rh1;
        public double _Rh2;
        public double _Som()
        {
            return _Rh1 * _Rh1 + _Rh2 * _Rh2;
        }
        public double _Som2()
        {
            return Math.Sqrt(_Som());
        }
    }
}
code under button:
  private void button1_Click(object sender, EventArgs e)
        {
            double rhzijde1 = 0;
            double rhzijde2 = 0;
            double _Som2 = 0;
            double _Som = 0;
           
            rhzijde1 = double.Parse(textBox1.Text);
            rhzijde2 = double.Parse(textBox2.Text);
           
            textBox3.Text = _Som2.ToString();
        }
    }
}
Without use of a class it works.
 
     
    