public NewtonRaphson(Outside obj, double val) { parent = obj; if (val < 0) { throw new ArgumentOutOfRangeException("value must be greater than 0"); } parent.val = val; }
static void Main(string[] args) { Outside outside = new Outside(); Outside.NewtonRaphson newtonRaphson = new Outside.NewtonRaphson(outside, 3); Console.WriteLine(newtonRaphson.Sqrt()); newtonRaphson.Set(5); Console.WriteLine(newtonRaphson.Sqrt()); newtonRaphson.Set(37); Console.WriteLine(newtonRaphson.Sqrt()); }