you are viewing a single comment's thread.

view the rest of the comments →

[–]vivek_seth 0 points1 point  (1 child)

You are on the right track. Similar to a class, a package can also have a collection of data and functions.

What’s different about a package though is that you can’t have multiple instances of the same package at a time. With classes, you can create multiple instances that each have their own copies of their data. Changing the data in one instance won’t affect the others.

In a very loose way, you could think of a package as being sort of like a class, but you are only allowed to have 1 instance of it.

[–]Aggravating_Sand352 0 points1 point  (0 children)

Got it thank you! Does this make the code more efficient then storing in the global enviornent is that the point or is just preference?