473,473 Members | 1,807 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

parsing arguments in overloading

1 New Member
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 1899
Luuk
1,047 Recognized Expert Top Contributor
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.