Welcome to the Treehouse Community
Looking to learn something new?
The use of static properties in real world
What is the use of Static methods and properties in real world?
Shafeeq, as you know, static properties are class properties as opposed to instance or member properties -- they don't change from object to object. So what would make sense to have as class properties.
Say you have an Employee class and you want to assign a unique ID to each employee. You would have an employeeID instance (non-static) property. But you would also have a lastID property to store the number assigned to the last employee created, and you would increment it by 1 for the next employee in your constructor. You wouldn't want lastID to be non-static, and vary from object to object. You want it to be the same for all objects. It couldn't be a constant, because it needs to change every time a new employee is created. But when it changes it changes the same for each object.
Hope this helps.