C#�ࡢ�ӿڡ��鷽��� ࡢ - ӿ ʵ ͳ���� � ����������� ��
1. ʵ����������� ��������֣ 캯���ӿڲ��������κ ʵ� ��֡
namespace ConsoleApplication1
{
class Program
{
interface IMyInterface1 // ӿ� ڲ�������ʵ ��
{
void IMethod1();
void IMethod2();
}
abstract class AMyClass1
{
public abstract void AMethod1();
public abstract void AMethod2();
public AMyClass1() //��������Թ��캯�����ʵ ��
{
}
public void AMethod()
{
Console .WriteLine("AMyClass.Amethod." );
}
}
static void Main(string [] args)
{
}
}
}
Ƕ һ ӿ��������� ����� �� ں�һ����� ��࣬࣬࣬࣬࣬࣬࣬࣬࣬࣬࣬࣬࣬࣬ ڳ�������������һ ʵ�� � ����ַ AMyClass1
���ڽӿ Dz ġ ӿ е з δʵ������ ����� �� �� ���� ����������� ��ֵģ�������캯��Ҳ Dz� ���
еģ 2. л г ;� ��� ������� ���� �Ա���������Ա���������� ����� ���������������ԡ
Ƿǹ ģ ӿ в г����� ���� ��� �� ���� �Ա����������������� � ����ֻ й �������� �ԡ
namespace ConsoleApplication1
{
class Program
{
interface IMyInterface1
{
void IMethod1();
void IMethod2();
int IProperty1
{
set ;
get ;
}
}
abstract class AMyClass1
{
public abstract void AMethod1();
public abstract void AMethod2();
public void AMethod3()
{
Console .WriteLine("AMyClass.Amethod." );
}
private static void AMethod4()
{
}
private int i;
private static int j;
private double PI = 3.1514926;
private int aProperty;
int Aproperty {
get { return aProperty; }
set { aProperty = value ; }
评论1