国产探花免费观看_亚洲丰满少妇自慰呻吟_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


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 会同县| 镇沅| 赞皇县| 绩溪县| 姜堰市| 霍州市| 九江市| 礼泉县| 德惠市| 虞城县| 富民县| 山阳县| 达拉特旗| 宣恩县| 噶尔县| 湄潭县| 临澧县| 思南县| 慈利县| 连南| 昭觉县| 崇州市| 台安县| 泸定县| 涞源县| 无为县| 安陆市| 杂多县| 柏乡县| 无极县| 苗栗市| 台北县| 赤水市| 泰安市| 海林市| 长丰县| 九龙县| 伊宁市| 长岭县| 龙泉市| 黎川县|