Can we have a private constructor ?
Answer Posted / srikanth
We can make a constructor Private or protected.
1. Private constructor is classic example of implementing a
singleton class( A class with a single instance)
2. Protected constructors can be used when the class cannot
be instantiated but can only be inherited.
Is This Answer Correct ? | 108 Yes | 2 No |
Post New Answer View All Answers
write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.
What are objects in oop?
class type to basic type conversion
Advantage and disadvantage of routing in telecom sector
Why it is called runtime polymorphism?
What is difference between data abstraction and encapsulation?
Explain virtual inheritance?
What is solid in oops?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?
What are different oops concepts?
What is class and example?
What is a class and object?
What is object in oops?
What is this pointer in oop?
What does <> mean pseudocode?