Sharad Gupta

Sharad Gupta

  • 92
  • 19.7k
  • 8.5m

static method problem

Apr 24 2014 2:35 AM
suppose i create a class
 
like 
namespace x
{
class a
{
public SqlConnection getcon()
{
................some code
}
}
}
 
and i want to use it another application
i just add reference of that class 
using  x;
class b:a
 
{
public void xyz()
{
 and i just use the  getcon() method
}
but when i create static method like
static xys()
{
  here we want to create the obj of  "a" class then i use it why?
like  a obj = new a();
obj.getcon(); {why?}
 
}
}
 

Answers (1)