is there any way for an object to make it self no longer usable

Sean Campbell via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 19 05:02:49 PDT 2014


is there any way for an object to make it self no longer usable? 
eg

class someclass {
	string somevalue;
	bool someflag;
	int somelength;
	this (value,length,flag) {
		somevalue = value;
		someflag = flag;
		somelength = length;
	}
	void modify_value(string new_value){
		somevalue = new_value;
	}
	void finalize_data(){
		//do something with data
		//make this invalid
		// eg delete this or this = null
	}
}

I don't want to use a private flag to tell weather the object is 
valid or not


More information about the Digitalmars-d-learn mailing list