+ 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); }
5 Respuestas
+ 4
This works:
https://code.sololearn.com/cBmA6722zkqv/?ref=app
+ 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
}
}
+ 3
Masterpizza100 can you post the code?
+ 2
Denise Roßberg Thanks.
+ 1
' ; ' semicolon after main(). .. ???