Wednesday, April 22, 2009
How Could Two or More Objects Share Same Class Data
Most people understand that when a class object is implemented into use on the user’s interface, the object’s behaviors and attributes are instantiate to belong to this object and not to any another object of the same class. This makes each object require a unique name with the entire process making it very easy to keep different customer clients separated when processing their same data types during purchases. Keeping this data collection separate but uniquely tracked allows the data to stay dynamically available until the data is ready for database storage, which could even be at the end of the day.
But sometimes it might become necessary for the work interface to keep track of how many objects where created during the day, helping for timely reviews to be scheduled. For this type of class object support the class member of type static could be implemented to give a internal class scope behavior each object has ability to participate with. This causes a relationship to establish between a class's different objects, thus creating a static variable with class scope with the advantage of the class itself claiming the variable for the variable’s held value examination. Now instead of allowing the class static variable to be treated unique and separated with a object scope, each object when instantiate into usage could cause the static variable to increment itself to help the class keep track of how many objects are instantiate in usage during the day without any further complicate coding efforts.
Subscribe to:
Post Comments (Atom)




0 comments:
Post a Comment