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 |
write a program to find 2 power of a 5digit number with out using big int and exponent ?
Base class has two public data members. How can i derive a new class with one datamember as public and another data member as private?.
what are the ways in which a constructors can be called?
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
what are abstract classes and how they impliment , with example
what isthe difference between c structure and c++ class
create a class complex having real and imaginary part of a complex no. as a data member. overload the binary operators(+,- and *) to perform the operations on complex no. objects. overload binary operator using friend function.
2 Answers CTS, Delhi University,
what is costructor?
assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).
what is namespace? what are the uses of namespace?
What is inheritance in oop?
What is abstraction?