Difference between Constructors and static constructors?

Answers were Sorted based on User's Feedback



Difference between Constructors and static constructors? ..

Answer / nayer plame

In C++ the difference is: static constructor do not exist in
C++ and constructors do exist

Is This Answer Correct ?    7 Yes 1 No

Difference between Constructors and static constructors? ..

Answer / venkataramakrishna. danduri

The main thing is the constructoe can't be Static, int or
any other data type. It will simpley throws a error
messgae. It is just to confuse the candidate.

Example:
class A
{
public:
static A(){ a = 0;}
int a;
};

void main()
{
A a;
}

Is This Answer Correct ?    2 Yes 0 No

Difference between Constructors and static constructors? ..

Answer / ganagdhara c

the normal constructor is use to initialize the data elements of the objects which are either static are non static elements where as thee static constructors are use to initialize the static data elements in the class these static data elements are shared by all the objects of the class type these are created when the first object of the class type was created.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C++ General Interview Questions

If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?

0 Answers  


Write about c++ storage classes?

0 Answers  


What is the c++ code?

0 Answers  


Is c++ faster than c?

0 Answers  


What is class invariant in c++?

0 Answers  






If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

0 Answers  


What is the importance of mutable keyword?

0 Answers  


Differentiate between a deep copy and a shallow copy?

1 Answers  


Are vectors faster than arrays?

0 Answers  


What are default parameters? How are they evaluated in c++ function?

0 Answers  


Is c++ a high level language?

0 Answers  


How do you remove an element from a set in c++?

0 Answers  


Categories