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 oops concept with example?
Is enum a class?
Please send ford technologies placement paper 2 my mail id
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
2. Give the different notations for the class.\
What is cohesion in oop?
What is static in oop?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
write string class as your own class in java without using any built-in function
What is difference between polymorphism and inheritance?
Can abstract class have normal methods?
Templates mean
what is the drawback of classical methods in oops?
What is an example of genetic polymorphism?
Why is there no multiple inheritance?