What is static function and static class?

Answers were Sorted based on User's Feedback



What is static function and static class?..

Answer / anthony michael

Static function and static variable does not below to single
instance of a class.

To access static functions we don't need instance of a class
instead it can be accessed using the class name followed by
::operator as:
[class_name::static_function() ]

Is This Answer Correct ?    8 Yes 2 No

What is static function and static class?..

Answer / anthony michael

Sourisengupta

Static Class is not possible in C++. But it can be done in
Managed C++

Static Class:
For Static Class we can't create Instances and It can only
hold Static member's.

Creating a static class is therefore much the same as
creating a class that contains only static members and a
private constructor. A private constructor prevents the
class from being instantiated.

Is This Answer Correct ?    5 Yes 1 No

What is static function and static class?..

Answer / brainless

If compilers don't check your pointers strictly,
you can also write code as below,

class A
{
//some static function code here
//never access non-static attributes here
static void callMe() {}
};

int main()
{
A * inst = NULL;
(*inst).callMe();
}

Is This Answer Correct ?    1 Yes 2 No

What is static function and static class?..

Answer / sourisengupta

Anthony,

I got what is static function..but still waiting for the
definition of static class.

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More C++ General Interview Questions

How can you differentiate between inheritance and implementation in c++?

1 Answers  


What is the real purpose of class – to export data?

1 Answers  


What apps are written in c++?

1 Answers  


How can you quickly find the number of elements stored in a static array? Why is it difficult to store linked list in an array?

1 Answers  


What is the use of :: operator in c++?

1 Answers  


What ANSI C++ function clears the screen a) clrscr() b) clear() c) Its not defined by the ANSI C++ standard

1 Answers  


Is oops and c++ same?

1 Answers  


write a c++ program that gives output 4 3 4 2 3 4 1 2 3 4 using looping statement

4 Answers  


What is class definition in c++ ?

1 Answers  


Write about the various sections of the executable image?

1 Answers  


Does c++ have a hash table?

1 Answers  


write a program to add two numbers without using an arithmetic operator.

1 Answers   NIIT,


Categories