V
vinnie
I did my first project with the classes, but i get an error that i
don't understand, and so don't know how to correct it.
The error is :
"Error 1 'mixed_class.Program' does not contain a definition for
'Calculus' and no extension method 'Calculus' accepting a first
argument of type 'mixed_class.Program' could be found (are you missing
a using directive or an assembly reference?) C:\Documents and Settings
\Robert\Desktop\prova VS8\mixed_class\Program.cs 20 20 mixed_class"
This is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mixed_class
{
public class Program
{
public static void Main(string[] args)
{
double c = 0;
Console.WriteLine(" Program for calculating the sum");
Console.WriteLine();
Console.WriteLine(" Insert first value:...");
double a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(" Insert the second value:... ");
double b = Convert.ToDouble(Console.ReadLine());
Program So = new Program();
c = So.Calculus(3, 4);
Console.WriteLine(" The sum is: {0}", c);
Console.ReadLine();
}
}
public class summing
{
public double Calculus(double a, double b, out double c)
{
c = a + b;
return c;
}
}
}
don't understand, and so don't know how to correct it.
The error is :
"Error 1 'mixed_class.Program' does not contain a definition for
'Calculus' and no extension method 'Calculus' accepting a first
argument of type 'mixed_class.Program' could be found (are you missing
a using directive or an assembly reference?) C:\Documents and Settings
\Robert\Desktop\prova VS8\mixed_class\Program.cs 20 20 mixed_class"
This is the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mixed_class
{
public class Program
{
public static void Main(string[] args)
{
double c = 0;
Console.WriteLine(" Program for calculating the sum");
Console.WriteLine();
Console.WriteLine(" Insert first value:...");
double a = Convert.ToDouble(Console.ReadLine());
Console.WriteLine(" Insert the second value:... ");
double b = Convert.ToDouble(Console.ReadLine());
Program So = new Program();
c = So.Calculus(3, 4);
Console.WriteLine(" The sum is: {0}", c);
Console.ReadLine();
}
}
public class summing
{
public double Calculus(double a, double b, out double c)
{
c = a + b;
return c;
}
}
}