|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NS1;
namespace namespace1
{
class Program
{
static void Main(string[] args)
{
Student student1 = new Student("TOM");
student1.OutPutName();
global::Car car1 = new Car("科鲁兹");///提示未能在全局命名空间中找到类型或命名空间Car,是不是必须要系统定义的类型或者命名空间才能如此搜索
car1.OutPutName();
Console.Read();
}
}
}
namespace NS1
{
class Student
{
string name;
public Student(string name)
{
this.name = name;
}
public void OutPutName()
{
Console.WriteLine(this.name);
}
};
namespace NS2
{
class Car
{
string name;
public Car(string name)
{
this.name = name;
}
public void OutPutName()
{
Console.WriteLine(this.name);
}
}
}
} |
|