namespace My2DShapes
{
public class Hexagon{}
}
namespace My3DShapes
{
public class Hexagon{}
}
Now assume you wish to create an instance of the 3D Hexagon from the following application:
using My2DShapes;
using My3DShapes;
public class MyApp
{
public static void Main()
{
// Error! Which Hexagon?
Hexagon h = new Hexagon();
}
}
This name clash can be resolved quite simply by building the following alias:
using My2DShapes;
using The3DHex = My3DShapes.Hexagon;
public class MyApp
{
public static void Main()
{
// This really creates a new My3DShapes.Hexagon.
The3DHex h = new The3DHex();
}
}
public class Hexagon{}
}
namespace My3DShapes
{
public class Hexagon{}
}
Now assume you wish to create an instance of the 3D Hexagon from the following application:
using My2DShapes;
using My3DShapes;
public class MyApp
{
public static void Main()
{
// Error! Which Hexagon?
Hexagon h = new Hexagon();
}
}
This name clash can be resolved quite simply by building the following alias:
using My2DShapes;
using The3DHex = My3DShapes.Hexagon;
public class MyApp
{
public static void Main()
{
// This really creates a new My3DShapes.Hexagon.
The3DHex h = new The3DHex();
}
}
댓글 없음:
댓글 쓰기