what is static function

Answers were Sorted based on User's Feedback



what is static function..

Answer / anil bisht

Static member functions have a class scope and they do not
have access to the 'this' pointer of the class. When a
member is declared as static, a static member of class, it
has only one data for the entire class even though there are
many objects created for the class. The main usage of static
function is when the programmer wants to have a function
which is accessible even when the class is not instantiated.

Is This Answer Correct ?    19 Yes 0 No

what is static function..

Answer / aavesh yadav

Static functions are functions which can access only static
variables and local variables.It can be called by class
name bcoz it is specific for a class in which it is
defined,not for any specific object of that class.It can
not be inherited also.

Is This Answer Correct ?    7 Yes 4 No

Post New Answer

More C++ General Interview Questions

Why is that unsafe to deal locate the memory using free( ) if it has been allocated using new?

1 Answers  


How do you initialize a class member, class x { const int i; };

8 Answers   emc2,


When should I use unitbuf flag?

1 Answers  


Can char be a number c++?

1 Answers  


Write a program to interchange 2 variables without using the third one.

1 Answers  


When is a template a better solution than a base class?

1 Answers  


When do we run a shell in the unix system?

1 Answers  


What happens when you make call 'delete this;'?

1 Answers  


What is c++ redistributable?

1 Answers  


Write a function to find the nth item from the end of a linked list in a single pass.

1 Answers   Huawei,


What is anonymous object in c++?

1 Answers  


class Alpha { public: char data[10000]; Alpha(); ~Alpha(); }; class Beta { public: Beta() { n = 0; } void FillData(Alpha a); private: int n; }; How do you make the above sample code more efficient? a) If possible, make the constructor for Beta private to reduce the overhead of public constructors. b) Change the return type in FillData to int to negate the implicit return conversion from "int" to "void". c) Make the destructor for Alpha virtual. d) Make the constructor for Alpha virtual. e) Pass a const reference to Alpha in FillData

2 Answers   Quark,


Categories