Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Can we create object of class with private constructor?

Answers were Sorted based on User's Feedback



Can we create object of class with private constructor?..

Answer / cracker singh

yes

Is This Answer Correct ?    12 Yes 5 No

Can we create object of class with private constructor?..

Answer / fareed

yes we can

public class Person{
privat Person(){
}
public hai(){
System.out.prinln("hai guys");
}
public static Person getobj(){
return new Person();
}

public class Manage{
public static void main(String[] args){
Person pr=Person.getobj();
pr.hai();
}
}

Is This Answer Correct ?    0 Yes 0 No

Can we create object of class with private constructor?..

Answer / 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

Can we create object of class with private constructor?..

Answer / supriya

No we cannot create the objects of class with private
constructor outside the class

Is This Answer Correct ?    0 Yes 1 No

Can we create object of class with private constructor?..

Answer / rahul dhangar

class Rahul
{
private:
int a,b,c;
Rahul()
{ cout<<"enter the no";
cin>>a>>b;
c=a+b;
cout<<c;

}
};
void main()
{
Rahul();
getch();


}

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More OOPS Interview Questions

State what is encapsulation and friend function?

0 Answers   BirlaSoft,


What is a function in oop?

0 Answers  


What is the real time example of inheritance?

0 Answers  


explain defference between structure and class with example

2 Answers  


write a c++ code of diagonal matrix.

2 Answers  


What is coupling in oop?

0 Answers  


difference between overloading and overridding

11 Answers  


Can you explain polymorphism?

0 Answers  


Input: enter the value:1234 output: 1 2 3 4 write a program to get above output.....

4 Answers   Bally Technologies, IBM, SoftSol,


What is class encapsulation?

0 Answers  


Can you inherit a private class?

0 Answers  


What is the difference between declaration and definition?

20 Answers   IBS,


Categories