C
C#2mo ago
blunt

✅ new

I've seen people write code like this and I was wondering what it does and what it is called. An example is, apple apple = new apple(); if you know what this is, please help me.
10 Replies
Anton
Anton2mo ago
it's called object creation it allocates memory for an object of the type after new and then calls its constructor
FusedQyou
FusedQyou2mo ago
I suggest you start following a basic c# tutorial considering this is the second question I see posted from you that a tutorial would explain
felsokning
felsokning2mo ago
It's also known as object instantiation. You have an object class Apple that has a default .ctor (read: constructor) that is Apple() and that creates/instantiates a new instance of Apple.
FusedQyou
FusedQyou2mo ago
There will be a lot you have to learn, and asking it all here makes no sense
blunt
bluntOP2mo ago
thanks what can u do with these instances tho?
Anton
Anton2mo ago
it's memory it's for remembering values of stuff
blunt
bluntOP2mo ago
but cant we just use variables?
Anton
Anton2mo ago
through types you can group multiple variables sorta
blunt
bluntOP2mo ago
ohhhh ok tysm
Anton
Anton2mo ago
np
Want results from more Discord servers?
Add your server