Hi,
Can anybody explain me how to create a sealed class on c++.
thanks in advance,
kedar
A start?
i know this solution using private constructor.
So, the user has to call the static method to create the new object. Is there anything better than this.
#include <iostream.h>
#include <conio.h>
class SealedBase
{
protected:
SealedBase()
{
}
};
#define Sealed private virtual SealedBase
class Penguin : Sealed
{
};
class BigZ : Penguin
{
};
void main()
{
BigZ bigZ;//cannot create obj beacuse penguin is sealed
clrscr();
cout<<"Sample for selaed":
getch();
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.