C
C#4mo ago
restock2009

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
Anton4mo ago
Remove the () in class Dog(){
HeckerMaster
HeckerMaster4mo ago
write in visual studio
restock2009
restock2009OP4mo ago
thank you, i cant believe it was that simple
Pobiega
Pobiega4mo ago
also, for the future, when posting code in discord, please use a code block: $code
MODiX
MODiX4mo 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/

Did you find this page helpful?