亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

c# 修飾符“public”對該項無效

c# 修飾符“public”對該項無效

C#
哈士奇WWW 2018-12-07 11:24:32
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace Test10_3{ interface ImyInterface1 { int Add(); } interface ImyInterface2 { int Add(); } class Myclass:ImyInterface1,ImyInterface2 { public int ImyInterface1.Add() { int x = 3; int y = 7; return x + y; } public int ImyInterface2.Add() { int x = 3; int y = 7; int z = 5; return x + y + z; } } class Program { static void Main(string[] args) { Myclass myclass = new Myclass(); ImyInterface1 imyinterface1 = myclass; ImyInterface2 imyinterface2 = myclass; Console.WriteLine(imyinterface1.Add()); Console.WriteLine(imyinterface2.Add()); Console.ReadLine(); } }} 代碼如上,報錯行標黃
查看完整描述

1 回答

?
蝴蝶刀刀

TA貢獻1801條經驗 獲得超8個贊

顯示接口成員實現中不能包含訪問修飾符。

顯示接口成員屬于接口的成員,不屬于類的成員。只能通過接口對象來訪問。

查看完整回答
反對 回復 2018-12-24
  • 1 回答
  • 0 關注
  • 917 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號