Using External Namespace
using System;
namespace First
{
class Employee
{
// Member variables
private string fname = "John";
private string lname = "Smith";
//Methods
public string getFname()
{
return fname;
}
public string getLname()
{
return lname;
}
}
}
namespace Second
{
class employer
{
static void Main(string[] args)
{
First.Employee e = new First.Employee();
String first_name = e.getFname();
String last_name = e.getLname();
Console.WriteLine("Name of the employee: " + first_name + " " + last_name);
Console.ReadLine();
}
}
}
Output:
Name of the employee: John Smith