| Below code code will help us to create object of one class and use functions of class in another class.
namespace SampleConsoleApplication
{
class FirstClass
{
int a;
Single b;
public void Setvalue(int a, Single b)
{
this.a = a;
this.b = b;
}
public void printdata()
{
Console.WriteLine(i + " " + j);
}
}
class SecondClass
{
static void Main(string[ ] args)
{
//create object of first class
FirstClass obj1 = new FirstClass();
obj1.Setvalue(14, 2.4f);
obj1.printdata();
}
}
} | | |