[ROOT] derive a class from TGraph

From: Jianglai Liu (jianglai@jlab.org)
Date: Wed Nov 05 2003 - 23:36:50 MET


Dear ROOTers,

This is pretty much a C++ question. I would appreciate any help.

I like to create a derived class from TGraph, which takes a more
complicated class object in the constructor, processes it, and then
invokes TGraph(n,x,y) c-tor. 

To demonstrate, suppose we have a 2D array xy[2][n]. In pseudo-code, I
like the class c-tor to do something like:

TMyGraph(Float** xy, n){
    -- split xy[2][n] into x[n] and y[n];
    -- invoke TGraph(n,x,y) c-tor
}

So I don't want to invoke TGraph c-tor right at the beginning of the
implementation. I know I can achieve the same thing by having a TGraph
object member in this new class, instead of deriving it from TGraph. But I
feel it is much less transparent for futher handling of the class. Eg.
later I want to add bunches of these objects into a TMultiGraph ...

Is there a way to do such things? Thanks in advance!

Jianglai

	



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET