Raised This Month: $ Target: $400
 0% 

What is the difference in the way these variables are declared?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode