Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

faggot needs help

Name: Anonymous 2012-06-29 2:50

I feel really stupid asking for help for something like this but i just can't see where the fuck is the problem. The compiler only say that it can't be assigned 'SetX' because is a 'group of methods'



namespace area
{
    class Rectangulo
    {
        private int X;
        private int Y;
        public int GetX()
        {
            return X;
        }
        public int GetY()
        {
            return Y;
        }
        public bool SetX(int ValX)
        {
            if(ValX!=Y)
            {
                X=ValX;
                return true;
            }
            else
                return false;
        }
        public bool SetY(int ValY)
        {
            if(ValY!=X)
            {
                Y=ValY;
                return true;
            }
            else
                return false;
        }
    }
    class Program
    {
        public static void Main(string[] args)
        {
            int m;
            int n;
            int a;
            Rectangulo R1=new Rectangulo();
            R1.SetX=m;
            R1.SetY=n;
            a=m*n;
           
            Console.WriteLine(a);
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}


Anyone, help

Name: Anonymous 2012-06-29 2:55

Assuming this is C#, god your code is a mess... Half this shit can be combined with properties...

namespace area
{
    class Rectangulo
    {
        private int x;
        private int y;

        public int X
        {
           get
           {
             return x;
           }
           set
           {
             if(x != value)
                x = value;
           }
        }


        public int Y
        {
           get
           {
             return y;
           }
           set
           {
             if(y != value)
                y = value;
           }
        }

       
        public int Area
        {
           get
           {
             return X * Y;
           }
        }
    }

    class Program
    {
        public static void Main(string[] args)
        {
            int m;
            int n;

            Rectangulo R1=new Rectangulo();
            R1.X=m;
            R1.Y=n;
          
            Console.WriteLine(R1.Area);
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

Oh yeah, you forgot to initialize the variables m and n in static void main.

Name: Anonymous 2012-06-29 7:34

vete a tomar por culo panchito de mierda

Name: Anonymous 2012-06-29 8:24


R1.SetX(m);
R1.SetY(n);

Name: Anonymous 2012-06-29 12:55

namespace area{class Rectangulo{
private int x,y;public int X{get{return x;}
set{if(x != value) x = value;}}public int Y{get{return y;}
set{if(y != value) y = value;}}public int Area{get{return X * Y;}}}
class Program{public static void Main(string[] args){
int m=4,n=2;Rectangulo R1=new Rectangulo();R1.X=m;R1.Y=n;
Console.WriteLine(R1.Area);
Console.Write("Press any key to continue . . . ");
Console.ReadKey(true);}}}

FUCKING OPTIMIZED

Name: Anonymous 2012-06-29 13:01

Thank you a lot, yes is C#. I'm trying to get used to the compiler and i'm just starting

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List