Can we create object of class with private constructor?
Answer Posted / rajneesh
Public class mainclass
{
private static mainclass _obj = null;
private constr()
{
}
public static mainclass obj
{
get
{
return _obj
}
}
}
after that you can access the obj in other class .
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is polymorphism and its types?
hi all..i want to know oops concepts clearly can any1 explain??
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
Why is abstraction needed?
What is inheritance in oop?
What are the benefits of interface?
What is methods in oop?
Following are the class specifications: class {int a}; class {int b}; Using friend funtion,calculate the max of two objects and display it.
What is oops with example?
Can main method override?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
write a programe to calculate the simple intrest and compund intrest using by function overlading
Can abstract class have normal methods?
i am getting an of the type can not convert int to int *. to overcome this problem what we should do?
What is ambiguity in inheritance?