CSharp examples for Custom Type:interface
Hiding Interface Members
using System;// w ww . j av a2 s. co m public interface IShape { // members left out to simplify example... int ShapeShifter( int val ); int Sides { get; set; } } public class Shape : IShape { private int InSides; public int Sides { get { return InSides; } set { InSides = value; } } int IShape.ShapeShifter( int val ) { Console.WriteLine("Shifting Shape...."); val += 1; return val; } public Shape() { Sides = 5; } } public class Hide { public static void Main() { Shape myShape = new Shape(); Console.WriteLine("My shape has been created."); Console.WriteLine("Using get accessor. Sides = {0}", myShape.Sides); IShape tmp = (IShape) myShape; myShape.Sides = tmp.ShapeShifter( myShape.Sides); Console.WriteLine("ShapeShifter called. Sides = {0}", myShape.Sides); } }