C
C#5mo 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
Anton5mo ago
it's called object creation it allocates memory for an object of the type after new and then calls its constructor
FusedQyou
FusedQyou5mo 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
felsokning5mo 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
FusedQyou5mo ago
There will be a lot you have to learn, and asking it all here makes no sense
blunt
bluntOP5mo ago
thanks what can u do with these instances tho?
Anton
Anton5mo ago
it's memory it's for remembering values of stuff
blunt
bluntOP5mo ago
but cant we just use variables?
Anton
Anton5mo ago
through types you can group multiple variables sorta
blunt
bluntOP5mo ago
ohhhh ok tysm
Anton
Anton5mo ago
np

Did you find this page helpful?