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 |
What is function prototyping? What are its advantages?
How many types of classes are there in c++?
Explain rethrowing exceptions with an example?
What will i and j equal after the code below is executed? Explain your answer.
When do we run a shell in the unix system?
Describe about storage allocation and scope of global, extern, static, local and register variables?
Define the operators that can be used with a pointer.
What does '\r' and '\b' mean? Please explain with example.
Live example for static function?
Why is it necessary to use a reference in the argument to the copy constructor?
Explain the concept of memory leak?
Define pointers?