package
{
import flash.errors.IllegalOperationError;
public class PublicClass
{
private static var instance:PublicClass;
public function PublicClass(pvt:PrivateClass=null)
{
if(pvt == null)
throw new IllegalOperationError("本类实例应由getInstance()获得。")
}
public static function getInstance():PublicClass
{
if (instance==null)
PublicClass.instance=new PublicClass(new PrivateClass());
return PublicClass.instance;
}
}
}
class PrivateClass
{
public function PrivateClass(){}
}