The interface definition properties in C # are as follows:
1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.Linq;4 usingSystem.Text;5 6 namespacech08ex057 {8 Abstract classHotdrink9 {Ten floatMilk; One floatSugar; A - Public intDrink (intx); - Public intAddmilk (intx); the Public intAddsugar (intx); - - } - + Public InterfaceIcup - { + intColor; A intVolume; at intRefill (intx); - BOOLWash (); - - } - classCupofcoffee:hotdrink,icup - { in intBeantype; - to Public intDrink (intx) + { -Console.WriteLine ("Welcome,drink a cup of Coffee?? \ n"); the * returnx; $ }Panax Notoginseng - ... ... the } + A classCupoftea:hotdrink,icup the { + intLeaftype; - $ Public intDrink (intx) $ { -Console.WriteLine ("Welcome,drink a cup of Tea?? \ n"); - the returnx; - }Wuyi the ... ... - } Wu - class Program About { $ Static voidMain (string[] args) - { - -Cupofcoffee coffee=NewCupofcoffee (); ACoffee.drink (2); + ... the - } $ the the the } the - in}
The above code hints error:
Lines 21st and 22nd,Interfaces cannot contain fields.
The interface in C # declares a property, but there is no attribute in the hint "interface".