Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C++

bucket sort

2.00/5 (6 votes)
29 Dec 2009CPOL 14.8K  
#include<iostr...
#include<iostream.h>
#include<conio.h>

class SealedClass //Sealed Class
{
private:
	SealedClass(){} //Declaring the Constructor in the Private Section hence preventing it to be called out side the class
public:
	int A;
	static SealedClass GetInstance()
	{
		SealedClass sealedclassObj;
		return sealedclassObj;
	}
};

class Inherited : SealedClass //will produce an Error SealedClass::SealedClass() is not accessible
{
public:
	Inherited() {};
};

void main()
{
	int i;
	clrscr();
	SealedClass SC = SealedClass::GetInstance(); //This way you can create the object of Sealed Class
	SC.A = 10;
	SealedClass SC1 = SealedClass::GetInstance();
	SC1.A = 20;

	cout << "SC.A = " << SC.A << "\n";
	cout << "SC1.A = " << SC1.A;
	getch();
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)