What are Static Members ?
Static members of a class are defined once in a definition and are assigned with keyword static. It simply means this variable is static variable. It will be put as a separate copy and anyone can point it.
What are Instance Members ?
Instance Members are normal variables and method which will keep as a copy.
Why we need both and what is the use of these members?
Static members will reduce the time of execution and save memory by keeping only one copy of variable to point.
As class is concept of OOPS and our NAV is based on objects so there will be no concept of these members.
Lets see some example for reference :
Hope this part is understandable with this post if not kindly comment.
No comments:
Post a Comment