TF1 Derived Class

I’m wondering if anyone can give me some general pointers on how to make a derived class with TF1 as the base. Everything seems to be working now except after fitting a TH1 in HFitImpl.cxx in version 5-34-01. The fit is being copied to the TH1 and an error is thrown Error in <TClass::New>: cannot create object of class derivedTF1Class Fatal: fnew1 violated at line 563 of `/opt/root_v5-34-01/hist/hist/src/HFitImpl.cxx' aborting

I provide an example as soon as I can shorten the quite lengthy usage i currently have.

Here is the smallest possible example. It removes the reasoning for actually doing all this but it demonstrates the problem.

The build commands used were

.L GaussFcn.cxx+ .L fcnConstructor.cxx+ .L TF1DerivedClass.cxx+

To see the issue simply run this example:

[code]#include “GaussFcn_cxx.so”
#include “fcnConstructor_cxx.so”
#include “TF1DerivedClass_cxx.so”

void runMe() {
TH1F *h = new TH1F(“h”,“hist”,100,-1,1);
h->FillRandom(“gaus”);

TF1DerivedClass *fit = new TF1DerivedClass(“fitName”,-1,1);

h->Fit(fit);
}
[/code]
TF1DerivedClass.cxx (189 Bytes)
TF1DerivedClass.h (288 Bytes)
fcnConstructor.cxx (110 Bytes)
fcnConstructor.h (167 Bytes)
GaussFcn.cxx (184 Bytes)
GaussFcn.h (146 Bytes)

I’ve solved the problem. I had forgotten to make a default constructor and a Copy method. I’ve corrected the TF1DerivedClass and everything works as expected. I attached the corrected version in case anyone was curious.
TF1DerivedClass.cxx (338 Bytes)
TF1DerivedClass.h (350 Bytes)