• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 656
  • Last Modified:

actionscript 3 - Global variables and methods

I'm requesting opinions here gurus.

My project requires a lot of globabl data. So my question is which way is better.

1. I can create a class with static variables and static functions - which I import into my classes to get access to these variables and functions.
2. I can create a class with these variables and functions and extend this class as the base class with every class I make.

I'm thinking to use method 1 but interested which you think is better.
With Thanks,
0
jasonb2
Asked:
jasonb2
1 Solution
 
CyanBlueCommented:
I'd say first one is easier and safer because you don't have to worry about having duplicate instances you might make accidentally with the method #2...  But they both should be equally the same as long as you are careful about that issue I mentioned...  That's my 2 cents...

CyanBlue
0
 
Pravin AsarPrincipal Systems EngineerCommented:
Normally I would use option #2
This way, if required you may make some variables private/protected etc.


Option #1 is something similar to abstract class in C++, which is good for  utility functions/methods
e.g. Math class
 
0
 
jasonb2Author Commented:
thanks for the input mate :)

I've made my constants public and my variables are protected which I access through public Get & Set functions.

I thought that was using the advantages of both methods.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now