I seem to get this error when I compile my code:
Error 1 'ConsoleApplication1.Class1.COUT()' is inaccessible due to its protection level
[code]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
void COUT()
{
System.Console.WriteLine("Hello");
}
}
}
[/code]
[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Class1.COUT();
System.Threading.Thread.Sleep(30000);
}
}
}
[/code]
[cpp]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
// needs to be static if you want it usable without an instance of Class1
// needs to be designated public, it's private (internal to class only) by default
public static void COUT()
{
System.Console.WriteLine("Hello");
}
}
}[/cpp]
More importantly though, why the heck is your static member function named COUT in all-caps? :v:
[QUOTE=jA_cOp;20736531][cpp]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Class1
{
// needs to be static if you want it usable without an instance of Class1
// needs to be designated public, it's private (internal to class only) by default
public static void COUT()
{
System.Console.WriteLine("Hello");
}
}
}[/cpp]
More importantly though, why the heck is your static member function named COUT in all-caps? :v:[/QUOTE]
Thanks for the help. And the reason why it's COUT is because my function is better than the WriteLine function.
No it's not it only does one thing
Sorry, you need to Log In to post a reply to this thread.