# TFile default constructor usage

**URL:** <https://root-forum.cern.ch/t/tfile-default-constructor-usage/36210>\
**Category:** Newbie\
**Created:** [October 2, 2019, 7:14pm UTC](https://root-forum.cern.ch/t/tfile-default-constructor-usage/36210 "2019-10-02T19:14:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![riley-x](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/riley-x/32/19902_2.png) [@riley-x](https://root-forum.cern.ch/u/riley-x)\
**Post date:** [October 2, 2019, 7:14pm UTC](https://root-forum.cern.ch/t/tfile-default-constructor-usage/36210/1 "2019-10-02T19:14:49Z")

</div>

I noticed `TFile` admits a [default constructor](https://root.cern.ch/doc/master/classTFile.html#a9f7b758404c0bb3fd49e08d49ef833e0). This is useful to create classes with a `TFile` member, and not have to initialize the file in the constructor.

However, how does one subsequently open a file from a default-constructed `TFile`? I could not find a non-static `TFile::Open` function.

The alternative, of course, is to use pointers, but that is not RAII.

Version: Head
