View Single Post
Author Message
Leech_v2
Senior Member
Join Date: Mar 2011
Location: Chinese GuangDong
Old 10-06-2023 , 16:10   What is the difference in the way these variables are declared?
Reply With Quote #1

What is the difference between adding 'new' and removing 'new'?

What I want to know is the purpose of using 'new' in combination with other specifier.
As far as I know, the feature of 'new' is that it allows declared variables to use runtime expressions as initialization expressions. However, runtime expressions cannot be used outside of a function, so I am wondering why it can be combined with other specifier?

Code:
new stock gVar;
stock gVar;

new static gVar;
static gVar;

new public gVar;
public gVar;

new static stock gVar;
static stock gVar;

Last edited by Leech_v2; 10-07-2023 at 01:34. Reason: Add more explanation
Leech_v2 is offline