Hy guys,
I am having a weird situation with a behavior of this class, and I am not understanding the reason.
Could you please help me?
I have this Class Teste.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace RMAFF.Engine { public class Teste { public int TesteFunction() { int teste = 10;
return teste; }
} }
|
And I am trying to access the function TesteFunction() in this other class Teste2.cs, but no success. I can access the class Teste, but I can't access the public function TesteFunction.
using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace RMAFF.Engine { class Teste2 { void caramba() { Teste.[the function do not appears here] } } }
|
Thanks in advance.
rohit kumarPosted Jun 30, 2010, 6:19 AM
because your method ,you have called in 2nd class is not staitc thats why can't be accessed by class name,
to do so either make an object of teste() class or put static KW with your method definition...
Daniel VarghesePosted Jun 23, 2010, 2:47 PM
The above class is not accessible because you have not instantiated the class.
Please try the below code to see if it works,