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

What is the difference between a pointer and a link in c ++?

0 Answers  


How to create a pure virtual function?

1 Answers  


Differentiate between a template class and class template?

1 Answers  


Write a program to find the Factorial of a number

0 Answers  


What is the difference between global int and static int declaration?

0 Answers  






What is a catch statement?

0 Answers  


Explain rethrowing exceptions with an example?

0 Answers  


What is data hiding c++?

0 Answers  


make a middle node of doubly linklist to the top of the list

1 Answers  


What are the two types of comments, and how do they differ?

0 Answers  


What do you mean by ‘void’ return type?

0 Answers  


What is the role of static keyword for a class member variable?

0 Answers  


Categories