Interface中定义属性
来源:互联网 发布:下载的源码怎么用 编辑:程序博客网 时间:2024/05/21 09:59
using System;
interface IPoint
{
// Property signatures:
int x
{
get;
set;
}
int y
{
get;
set;
}
}
class Point : IPoint
{
// Fields:
private int _x;
private int _y;
// Constructor:
public Point(int x, int y)
{
_x = x;
_y = y;
}
// Property implementation:
public int x
{
get
{
return _x;
}
set
{
_x = value;
}
}
public int y
{
get
{
return _y;
}
set
{
_y = value;
}
}
}
class MainClass
{
static void PrintPoint(IPoint p)
{
Console.WriteLine("x={0}, y={1}", p.x, p.y);
}
static void Main()
{
Point p = new Point(2, 3);
Console.Write("My Point: ");
PrintPoint(p);
}
}
- Interface中定义属性
- Interface中定义方法
- 关于Interface中定义变量的注意事项
- PropertyGrid 中 类属性定义
- 关于如何访问interface中定义的变量
- @interface中定义变量与@property的区别
- Java中接口(Interface)的定义和使用
- Interface定义及使用
- 为什么要定义interface
- 接口:定义形式 interface
- 【interface】C#interface定义及使用浅析
- 在AS中定义public属性
- Javascript中定义类和静态属性
- PHP中属性和方法的定义
- 在ssh中定义属性时
- C#类中属性的定义
- XML中属性的定义方式
- android中自定义属性重复定义
- 第三方支付接口搜集(附下载)
- python对象的相等
- java 题目
- java 引用传递与值传递
- 文件相关操作[C#]
- Interface中定义属性
- RFID标签电路设计
- 使用MFC开发ActiveX控件
- 不求最好,但求最2
- PowerDesigner生成Oracle格式的SQL时如何去掉字段名的双引号
- 双人访谈的“三角关系”
- 谁动了我的奶酪
- 郁闷
- 三金的股价