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

Did you find this page helpful?