Constructors, Classes

I have been learning about classes, and when trying constructors in VS Code it gives my an error, eventhough i wrote it exactly like in the course im taking. class Dog(){ float age; private Dog(){ Console.WriteLine("Guau"); age=42; } }
5 Replies
Anton
Anton3w ago
Remove the () in class Dog(){
HeckerMaster
HeckerMaster3w ago
write in visual studio
restock2009
restock2009OP3w ago
thank you, i cant believe it was that simple
Pobiega
Pobiega3w ago
also, for the future, when posting code in discord, please use a code block: $code
MODiX
MODiX3w ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Want results from more Discord servers?
Add your server