i added this code
        class MainClass
        {
                static void Main(string[] args)
                {
                        Complex num1 = new Complex(2,3);
                        Complex num2 = new Complex(9,4);
                        Complex sum = new Complex(12,3);
                        Console.Out.WriteLine("{0}",sum.add(num1,num2));
                }
        }
but i'm getting 2 errors:
Static member...cannot be accessed with an instance reference-

the type of namespace numa 'sum' could be found(are you missing a
using directive or an assemby reference?)-



On 10 יולי, 06:24, Brandon Betances <[email protected]> wrote:
> What errors are you getting?
>
>
>
> On Thu, Jul 9, 2009 at 4:42 PM, thread <[email protected]> wrote:
>
> > hello all,
> > i'm trying to use this code in MainClass but nothing works:
> >        struct Complex
> >        {
> >                double r;
> >                double i;
> >                public Complex(double rt,double it)
> >                {
> >                        r = rt;
> >                        i = it;
> >                }
> >                public static Complex add(Complex a,Complex b)
> >                {
> >                        return new Complex(a.r+b.r,a.i+b.i);
> >                }
> >                public static Complex sub(Complex a,Complex b)
> >                {
> >                        return new Complex(a.r-b.r,a.i-b.i);
> >                }
> >                public static Complex mul(Complex a,Complex b)
> >                {
> >                        return new Complex(a.r*b.r,a.i*b.i);
> >                }
> >        }
>
> > does anyone have an idea for it?-הסתר טקסט מצוטט-
>
> -הראה טקסט מצוטט-

Reply via email to