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