static method with private methods within it [C#] -
i wanted make class draw have static method consolesquare() , wanted make other methods in class hidden (private).but got errors in marked places , don't know how solve them , still achieve same idea ( consolesquare() - static ; other methods hidden )
class draw { private string spaces(int k){ string str=""; for(;k!=0;k--) str+='\b'; return str; } private string line(int n,char c){ string str=""; for(;n!=0;n--) str+=c; return str; } public static void consolesquare(int n,char c){ string line = line(n,c); // ovdje string space = c + spaces(n - 2) + c; //ovdje console.writeline(line); (; n != 0; n--) console.writeline(space); console.writeline(line); } }
declare them private static
.
Comments
Post a Comment