Click here to Skip to main content
12,352,739 members (65,175 online)
Rate this:
 
Please Sign up or sign in to vote.
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 17-Dec-12 3:46am
Edited 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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Isn't it self explaining ..

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

and

public Fan(int speed, bool on, double raduis, string color)
{
this.speed = speed;
this.on = on;
this.raduis = raduis;
this.color = color;
}
  Permalink  
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Look at your code, you have the following constructors:
        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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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.
  Permalink  
Comments
Wes Aday 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 8 Aug 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100