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

Petrol pump mgt. system: To design a program that display an interface for the sale of the Petrol and then make the entries at the backend in the database.

1 Answers   Wipro,


What is the main feature of oop?

0 Answers  


I hv a same function name,arguments in both base class and dervied class, but the return type is different. Can we call this as a function overloading? Explain?

3 Answers  


Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?

5 Answers  


Given two strings like x=?hello? and y=?open?, remove any character from string x which is also used in string y, thus making the result x=?hll?.

13 Answers   IBM,






What is abstrac class?where is it use?

2 Answers  


Why do we use polymorphism in oops?

0 Answers  


define a string class. overload the operator == to compare two strings

2 Answers   Birla, Ericsson, HCL, Infosys, Infotech, MCAS, Satyam,


what type of questions

0 Answers   IBM,


What language is oop?

0 Answers  


How to hide the base class functionality in Inheritance?

0 Answers   Viscus Infotech,


WAP find square root of any number (without using sqrt() )?

3 Answers  


Categories