473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

parsing arguments in overloading

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace midq6
  7. {
  8.     class Program
  9.     {
  10.         const double pi=3.142;
  11.         static void Main(string[] args)
  12.         {
  13.             Program test = new Program();
  14.             test.area(2.0,2.8,4.0,4.9,5.0,3.8);
  15.  
  16.  
  17.         }
  18.  
  19.         public double area(double s) 
  20.         {
  21.             double area = s * s;
  22.             Console.WriteLine("Area of a square: "+ area);
  23.             return area;
  24.         }
  25.         public double area(double l, double w) 
  26.         {
  27.             double area = l * w;
  28.             Console.WriteLine("Area of a rectengle: "+ area);
  29.             return area;
  30.         }
  31.         public double area(double h,double b) 
  32.         {
  33.             double area = 0.5 * h * b;
  34.             Console.WriteLine("Area of a triangle: " + area);
  35.             return area;
  36.         }
  37.         public double area(double r) 
  38.         {
  39.             double area = pi * r * r;
  40.             return area;
  41.         }
  42.     }
  43. }
it gives me an error when trying to give arguments in my main method...please help
Sep 8 '15 #1
1 1896
Luuk
1,047 Expert 1GB
First error:
Expand|Select|Wrap|Line Numbers
  1. Severity    Code    Description    Project    File    Line
  2. Error    CS0111    Type 'Program' already defines a member called 'area' with the same parameter types    midq6    ...\Projects\midq6\midq6\Program.cs    31
  3.  

Second error:
Expand|Select|Wrap|Line Numbers
  1. Severity    Code    Description    Project    File    Line
  2. Error    CS0111    Type 'Program' already defines a member called 'area' with the same parameter types    midq6    ...\Projects\midq6\midq6\Program.cs    37
  3.  
Third error:
Expand|Select|Wrap|Line Numbers
  1. Severity    Code    Description    Project    File    Line
  2. Error    CS1501    No overload for method 'area' takes 6 arguments    midq6    ...\Projects\midq6\midq6\Program.cs    14
  3.  
This third error is in the main, and seems pretty clear to /me

It's claiming it does not know what to do with 6 parameters when doing something with 'area'.
Oct 4 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Rob Long | last post by:
Hey, I've just noticed a somewhat annoying feature with PHP5 type hinting. You cannot hint types on optional arguments like this: class MyClass { function someFunc(Type1 $arg1, Type2 $arg2...
17
by: Terje Slettebų | last post by:
To round off my trilogy of "why"'s about PHP... :) If this subject have been discussed before, I'd appreciate a pointer to it. I again haven't found it in a search of the PHP groups. The PHP...
1
by: Paul Probert | last post by:
I am trying to write a c interface function to be called with some optional arguments. In the python documentation section 5.5 "Parsing arguments and building values" it seems you can do it like...
15
by: Susan Baker | last post by:
Hello everybody, I'm new to C++ (I have some C background). I've read up on this topic a few times but it just dosen't seem to be sinking in. 1. Whats the difference between overloading and...
4
by: John Smith | last post by:
can we overload a javascript function with different argument? example: function a(a){} function a(a,b){}
18
by: uday | last post by:
Does C supports overloading. I am thinking no. But some people are saying yes. If yes how. Please answer with examples. Also in c++ size of empty class is one. why. and what are the default...
4
by: Doug | last post by:
Hi I am 'returning' to the learning of C# after a change in jobs and I remember that I used to struggle with the defintion, purpose and function of 'overloading'. When I was beginning with C# I...
1
by: Harris Kosmidis | last post by:
Hello, I'm writing a program and I'm stuck in something silly, which I thought it worked for some time. I want to parse the arguments. I want to run it like: ../prog image.jpg Here's the...
1
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
Why use overloading? I have used it to allow for optional arguments. It is also possible to use overloading to cater for arguments of different types, I believe. E.G. public string...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.