asked 185k views
1 vote
Assume the existence of a class named window with functions named close and freeresources, both of which accept no parameters and return no value . write a destructor for the class that invokes close followed by freeresources.

1 Answer

5 votes
In your question whereas there is a class named window and it would be like this:

class window {
//code here
}

Next is there is a function called close and freeresource and it goes like this:

class window{
function close( ){
//code here
}
function freeresource( ){
// code here
}
public destruct (){
this.close();
this.freeresource();
}

}
The last code function destruct invokes the function close and freeresource. Hope this would help