Can we create object of class with private constructor?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use polymorphism in oops?

575


How do you define social class?

594


What is polymorphism oop?

616


What is the difference between abstraction and polymorphism?

609


Why is polymorphism important in oop?

629






How Do you Code Composition and Aggregation in C++ ?

24187


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

2142


Write a c++ program to display pass and fail for three student using static member function

2808


program for insertion ,deletion,sorting in double link list

2276


What is polymorphism what is it for and how is it used?

571


What is the example of polymorphism?

554


How does polymorphism work?

634


What is oops in simple words?

575


What is encapsulation example?

545


What is destructor example?

591