C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 47)
47.
What will happen if a class is not having any name?
Discussion:
25 comments Page 1 of 3.
Djain said:
1 decade ago
Then, how will you instantiate that classes?
Ram bidwai said:
1 decade ago
If class is not having any name then how can we create object of that class and also we can't create constructor.
Dipty said:
1 decade ago
What is then nameless object?
Lalit kulkarni said:
1 decade ago
How we can create the object of the class?
Sonu said:
1 decade ago
Nameless class can be considered as Abstract class.
Sonu said:
1 decade ago
As name of class is d essential requirement to create constructor and destructor. So it can not be created. And also we can not create object of an Abstract class.
So Answer is option :D.
So Answer is option :D.
Kushal tewatia said:
1 decade ago
Can somebody give the example of a class having without name.
Seema said:
1 decade ago
We can create objects of nameless class but at the time of creation of the class.
For example this perfect.
class { public : intx }a; //a is the object of this class
main(){
a.x=10;
cout<<"a="<<a.x;
}
For example this perfect.
class { public : intx }a; //a is the object of this class
main(){
a.x=10;
cout<<"a="<<a.x;
}
Rhuda said:
1 decade ago
Its possible in C++ but is this true for java?
Rinku said:
1 decade ago
How can possible without class name constructor and destructor?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers