IceSkull[BE]
Legacy Member
Wanneer ik volgende code wil compilen, krijg ik deze fout:
"Error 1 An object reference is required for the nonstatic field, method, or property 'test_function.maths.add(float, float)' C:\Documents and Settings\Coudyzer Gertjan\Mijn documenten\Visual Studio 2005\Projects\HelloWorld\HelloWorld\hello.cs 28 28 HelloWorld
"
code:
using System;
using System.Collections.Generic;
using System.Text;
using test_function;
namespace test_function
{
class maths
{
public
float add(float num1, float num2)
{return num1 + num2;}
float subtract(float num1, float num2)
{return num1 - num2;}
float multiply(float num1, float num2)
{return num1 * num2;}
};
}
namespace HelloWorld
{
class hello
{
static void Main()
{
float result = maths.add(5, 3);
Console.WriteLine("{0}", result);
string output = Console.ReadLine();
}
}
ben wel maar net begonne
"Error 1 An object reference is required for the nonstatic field, method, or property 'test_function.maths.add(float, float)' C:\Documents and Settings\Coudyzer Gertjan\Mijn documenten\Visual Studio 2005\Projects\HelloWorld\HelloWorld\hello.cs 28 28 HelloWorld
"
code:
using System;
using System.Collections.Generic;
using System.Text;
using test_function;
namespace test_function
{
class maths
{
public
float add(float num1, float num2)
{return num1 + num2;}
float subtract(float num1, float num2)
{return num1 - num2;}
float multiply(float num1, float num2)
{return num1 * num2;}
};
}
namespace HelloWorld
{
class hello
{
static void Main()
{
float result = maths.add(5, 3);
Console.WriteLine("{0}", result);
string output = Console.ReadLine();
}
}
ben wel maar net begonne

: