Difference between Constructors and static constructors?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
the maximum length of a character constant can be a) 2 b) 1 c) 8
write a function signature with various number of parameters.
Why do we use templates?
Which one between if-else and switch is more efficient?
write a program to add two numbers without using an arithmetic operator.
You run a shell on unix system. How would you tell which shell are you running?
Define pure virtual function?
What is setiosflags c++?
How many lines of code you have written for a single program?
What is the meaning of string in c++?
What are the two main components of c++?
Write a note about the virtual member function?