国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

【轉載】#437

2019-11-17 03:18:15
字體:
來源:轉載
供稿:網友

【轉載】#437 - access Interface Members through an Interface Variable

Onece a class implementation a particular interface, you can interact with the members of the interface through any instance of that class.

1 Cow bossie = new Cow("Bossie", 5);2 3 // Cow implements IMoo, which includes Moo method4 bossie.Moo();

You can also declare a variable whose type is an interface, assign it to an instance of any class that implements that interface and then interact with members of the interface through that interface variable.

1 // bossie is a Cow, which implements IMoo, so we can point IMoo variable at her2 IMoo mooer = bossie;3 mooer.Moo();

Notice that we can't access members of Cow that aren't part of IMoo using this interface variable.

1 // Can't call Cow methods not in IMoo2 mooer.MakeSomeMilk();

Even though MakeSomeMilk is a public method in the Cow class, we can't access it via IMoo.

原文地址:#437 – Access Interface Members through an InterfaceVariable


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 武鸣县| 高碑店市| 康马县| 读书| 汶上县| 怀安县| 东乌| 南陵县| 浠水县| 丰都县| 阆中市| 龙州县| 锦屏县| 黔西县| 类乌齐县| 遵义县| 湘潭县| 承德市| 襄樊市| 安泽县| 会泽县| 高平市| 乌拉特前旗| 黄山市| 中山市| 读书| 锦屏县| 吴川市| 永安市| 石泉县| 沙洋县| 临朐县| 淮安市| 固阳县| 达州市| 酒泉市| 河曲县| 科技| 大荔县| 湛江市| 山东省|