Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
class Fan
    {
         class Fan
    {
        private int speed = 1;
        private bool on = true;
        private double raduis = 5.0;
        private string color = "blue";

     

        public int spee { get { return speed; } set { speed = value; } }
        public bool o { get { return on; } set { on = value; } }
        public double radu { get { return raduis; } set { raduis = value; } }
        public string colour { get { return color; } set { color = value; } }

        public Fan(int speed, bool on, double raduis, string color)
        {
            this.speed = speed;
            this.on = on;
            this.raduis = raduis;
            this.color = color; 
        }
        public Fan(int se)
        {
            speed = se;
        }
        public Fan(int se , bool t )
        {
            speed = se ;
            on = t;
        }
        public Fan(int se, bool t , double r)
        {
            speed = se;
            on = t;
            raduis = r;
        }
        public Fan(int seo, bool to, double ro, string ce)
        {
            speed = seo;
            on = tp;
            raduis = ro;
            color = ce;
        }
        public string DisplayFan()
        {
            String printme = null;

            if (fan.on = true)
            {
                printme = ("Speed: " +  get.spee() + " Color: " + fan.color + " Radius: " + fan.radius);
            }
            if (fan.on = false)
            {
                printme = ("Color: " + fan.color + " Radius: " + fan.radius + " Fan is Off");
            }

            return (printme);

        }

        }
     static void Main(string[] args)
        {
            Fan f1 = new Fan();
            f1.spee(3);
            f1.radu(10.0);
            f1.colour("Yellow");
            f1.DisplayFan(true);

            Fan f2 = new Fan();
            f2.spee(1);
            f2.radu(5.0);
            f2.colour("blue");
            f2.DisplayFan(false);
        }
    } 

    }


C# error:
already defines a member called 'Fan' with the same parameter types"
Posted
Updated 20-Dec-12 21:01pm
v4
Comments
lukeer 21-Dec-12 5:32am    
I assume this is the second time you ask this question, re-phrased. If it's the other way round, same applies nonetheless: Don't post the same question again. Use the "Improve question" link instead to provide further information. It helps keeping the topic together.

Isn't it self explaining ..

C#
public Fan(int seo, bool to, double ro, string ce)
{
speed = seo;
on = tp;
raduis = ro;
color = ce;
}


and

C#
public Fan(int speed, bool on, double raduis, string color)
{
this.speed = speed;
this.on = on;
this.raduis = raduis;
this.color = color;
}
 
Share this answer
 
Comments
CHill60 17-Dec-12 10:05am    
Or to put it another way ...
Each overload of a function must have a unique signature so the compiler can determine which one you actually meant to call.
You have two functions both with (int, bool, double, string) signature. Luckily for you they appear to trying to do the same thing
Look at your code, you have the following constructors:
C++
        public Fan(int speed, bool on, double raduis, string color)
        {
            this.speed = speed;
            this.on = on;
            this.raduis = raduis;
            this.color = color; 
        }

// 3 others removed for clarity

        public Fan(int seo, bool to, double ro, string ce)
        {
            speed = seo;
            on = tp;
            raduis = ro;
            color = ce;
        }

You cannot have two with the same signature, remove the one that you do not want.
 
Share this answer
 
I am getting this error in one of the silver light application which works fine in VS2010 bu when i oprned it in VS2013 its giving this error for all the initialize methods and also the services are not getting reffered, my services works fine.
 
Share this answer
 
Comments
[no name] 8-Aug-14 10:46am    
Exactly how is this a solution to the question asked, a year and a half ago?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900