Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

static variables

 
S Babs
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can i use static variables in Abstract classes and how it will be useful to me
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We can use the staic variables and static methods in the abstract class just like how we use them in normal classes the normal restrictions hold good and they are
1. They can only call other static methods (in case of static methods)
2.The static methods can only access the static data
3. They cannot refer "this" or "super" in any way.
The abstract classes are always extended and the static methods and static variables are used to make the method or variable common to all the objects and they are class but not object dependent.
Cheers,
Gaya3
-------------------------------------------------
Beginning is half done
 
Gayathri Prasad
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We can use the staic variables and static methods in the abstract class just like how we use them in normal classes the normal restrictions hold good and they are
1. They can only call other static methods (in case of static methods)
2.The static methods can only access the static data
3. They cannot refer "this" or "super" in any way.
The abstract classes are always extended and the static methods and static variables are used to make the method or variable common to all the objects and they are class but not object dependent.
Cheers,
Gaya3
-------------------------------------------------
Beginning is half done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic