Why static functions always uses static variables?

Answers were Sorted based on User's Feedback



Why static functions always uses static variables?..

Answer / george from psg

static function is constant to all object. In the same way
static variable is constant to all so we use static variable
in static function

Is This Answer Correct ?    9 Yes 1 No

Why static functions always uses static variables?..

Answer / som shekhar

If you take in the context of the class, static member
functions cannot be called by the ordinary objects because
when normal object calls the function then address of the
object is passed is collected by "this" pointer and static
member function don't have "this" pointer.

Is This Answer Correct ?    0 Yes 0 No

Why static functions always uses static variables?..

Answer / harsha

context,object are created in RAM. context is created
once.static methods implementaion , static varibles loads
into context only once.All those staic members avilable to
each other obviously.

Is This Answer Correct ?    2 Yes 3 No

Post New Answer

More OOPS Interview Questions

Why do we need polymorphism in c#?

0 Answers  


What is abstrac class?where is it use?

2 Answers  


wht is ditch

0 Answers  


What is polymorphism programming?

0 Answers  


What is oops in simple words?

0 Answers  






What is the difference between const int *ptr and int const *ptr???

2 Answers  


Can java compiler skips any statement during compilation time?

0 Answers  


When is a memory allocated to a class?

11 Answers  


Difference ways of Polymorphism?

3 Answers  


How many human genes are polymorphic?

0 Answers  


design class for linked list and include constructor,destructor,insert option. struct node { int node; struct node &ptr; }

1 Answers   HSBC,


What is the differances between a abstract calss and interface

5 Answers   Aviva, Symphony,


Categories