Dozd

Dozd

  • NA
  • 65
  • 0

about properties

Feb 7 2009 10:43 AM
  

Hi, I am beginner  in C# programming and try to do a class with private method for number addition. I  want to ask about:

How to set values for method’s parameters from properties? Value of a = Number1, and value b = Number2.Also how to set in Result  property addition of a+b?

Thanks for understanding


class myclass
    {
       
        
        public myclass()
        {
          

        }

        private double number1;

        public double Number1
        {
            get { return number1; }
            set { number1 = value; }
        }

        private double number2;

        public double Number2
        {
            get { return number2; }
            set { number2 = value; }
        }
        private double result;

        public double Result
        {
            get { return result; }
            
        }
    
        
        private double addition( double a,  double b)
        {
            return a + b;

        }

    }
}

Answers (1)