+ 1

Why I have error?

private static void Main(); { class Punkt { int x; int y; int PobierzX() { return x; } int PobierzY() { return y; } } Punkt punkt1 = new Punkt(); punkt1.x = 100; punkt1.y = 200; int wspX = punkt1.PobierzX(); int wspY = punkt1.PobierzY(); System.Console.WriteLine("Współrzędna x = " + wspX); System.Console.WriteLine("Współrzędna y = " + wspY); }

16th Jun 2019, 10:09 AM
Masterpizza100
Masterpizza100 - avatar
5 Respuestas
17th Jun 2019, 10:07 PM
Denise Roßberg
Denise Roßberg - avatar
+ 5
You should post the link of your code (from code playground). I think it is a problem that your class Punkt is inside your main method. Try this: class Punkt{ //your code } class Program{ main method{ //the code without the class Punkt } }
16th Jun 2019, 10:24 AM
Denise Roßberg
Denise Roßberg - avatar
+ 3
Masterpizza100 can you post the code?
17th Jun 2019, 8:49 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
17th Jun 2019, 4:29 PM
Masterpizza100
Masterpizza100 - avatar
+ 1
' ; ' semicolon after main(). .. ???
16th Jun 2019, 10:42 AM
Jayesh Patil
Jayesh Patil - avatar