I have a good resource management class. For concreteness, let it be the File class for managing the file * (handling opening and closing operations)
What is the usual approach when there are cases when the resource does not need to be managed by me, and someone else is responsible?
For illustrative purposes, I currently have something like this:
int main(int argc, char** argv)
{
File my_file(argv[1]);
return 0;
}
And I want something like
int main()
{
if(argc <= 1){
}else{
}
if(argc <= 1){
}else{
}
}
(but less ugly, more reliable, etc.)
source
share