Can we have a private constructor ?
Answers were Sorted based on User's Feedback
Answer / namrata ahuja
no. constructors are always declared publicly. they are used
to initialize data members of a class. they are
automatically invoked by a class object declaration so if it
is private it cannot be invoked.
| Is This Answer Correct ? | 6 Yes | 39 No |
Answer / ravi`
no,
we can not make a constructor private , if we make a
constructor private its method cannot access in main method .
| Is This Answer Correct ? | 17 Yes | 136 No |
what is the difference between class to class type conversion and copy constructor ?
What is the default size allocated for array in the statement if size not specified " int a[] "
When will a constructor executed?
Which keyword is written to use a variable declared in one class in the other class?
what is code for call by value and call by reference?
Why do we use encapsulation in oops?
is there any choice in opting subjects like 4 out of 7
What is multilevel inheritance?
#include <iostream> using namespace std; struct wow { int x; }; int main() { wow a; a.x = 22; int c = a.x; int *b = new int; cout << c; return 0; } option: No output 0 22 -(11) Will not compile
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
WAP to generate 2n+1 lines of the following pattern on the computer screen:
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.