Naming histograms declared inside class

Hi,
In my base class Object.h I declare a protected member variable histogram and string:
TH1 *FitHist;
TString ClassName;

In the inherited class Line.cpp I initialise these inside the constructor:
ClassName=“Line”;
FitHist = new TH1F(ClassName, ClassName, c.NRings, 1, c.NRings);

Every time I declare a new instance of the class Line I get a run time warning that I am replacing the existing histogram. I realise this is because the histograms are being created with the same name but it still surprises me as I thought that class encapsulation would solve this.
Short of passing a string every time I make an instance of class Line to give the histogram a new name, is there any smart way of declaring the hist so I don’t get this error? I don’t care what the name of the hists are as I change the naming later in the code anyway.
Cheers,
Ellie

Hi Ellie,
please read UserGuide (p. 24, Creating Histograms) => ftp://root.cern.ch/root/doc/3Histograms.pdf

Jan