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?
It cannot have a destructor.
It cannot have a constructor.
It is not allowed.
Both A and B.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
25 comments Page 2 of 3.

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.

Chintan said:   10 years ago
If you create class but not having any name, gives compilation error. So I think answer C is right.

Navya said:   5 years ago
It can have a destructor for the deallocation of memory, but the constructor cannot be allocated.
(1)

Nikhil said:   7 years ago
Can I do this for java too?

How can I do it for the class which contains main function.

Naveen pateriya vidisha said:   1 decade ago
Nice discussion its possible blindly to create a name less class.

Monika said:   9 years ago
Not satisfied with the answer of this question please elaborate.

Rinku said:   1 decade ago
How can possible without class name constructor and destructor?

Kushal tewatia said:   1 decade ago
Can somebody give the example of a class having without name.

Jatin said:   10 years ago
@Rahul.

I'm not getting any output as per your code.

Sonu said:   1 decade ago
Nameless class can be considered as Abstract class.


Post your comments here:

Your comments will be displayed after verification.