classProgram {Static voidMain (string[] args) {Ceshi wo; Student av=NewStudent (); Wo=NewCeshi (Av. Sum); Ceshi WO1=NewCeshi (Av. AVG); Av. Age= -; Av. Shuxue= -; Av. Yingyu= Max; Av. Yuwen= -; Console.WriteLine ("Total = {0},\n average = {1}", Wo (av. Shuxue, Av. Yuwen, Av. Yingyu), WO1 (Av. Shuxue, Av. Yuwen, Av. Yingyu)); Console.readkey (); }
Delegate DoubleCeshi (DoubleADoubleBDoublec); classStudent { Public DoubleSum (DoubleADoubleBDoublec) {returnA + B +C; } Public DoubleAVG (DoubleADoubleCDoubleb) {return(A + B + c)/3; } Private stringname; Private Charsex; Private intAge ; Private DoubleShuxue; Private DoubleYuwen; Private DoubleYingyu; Public stringName {Set{name =value;} Get{returnname;} } Public intAge {Set{age =value;} Get{returnAge ;} } Public DoubleShuxue {Set{Shuxue =value;} Get{returnShuxue;} } Public DoubleYingyu {Set{Yingyu =value;} Get{returnYingyu;} } Public DoubleYuwen {Set{Yuwen =value;} Get{returnYuwen;} } }
C # Properties