Re: [ROOT] abstract class object???

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Aug 09 2000 - 10:18:12 MEST


Hi Sean,

Could you send your file Rb_zbs_DataClass.hxx/cxx ?
Is this class an abstract class ? Are you defining all the pure functions
from this class in the derived class?

Rene Brun

Sean Walston wrote:
> 
> I get the following error message:
> 
>         root [0] .x foo.C
>         Error: abstract class object 'Foo Bar' declared FILE:foo.C LINE:9
>         *** Interpreter error recovered ***
> 
> Line 9 of foo.C is:
> 
>         Foo Bar( infile, outfile );
> 
> The code is all below: foo.C loads in the macro and trys (and fails) to
> create an object called Bar which is of type Foo. Foo.cxx and Foo.hxx
> define an empty class in that it has no member functions other than the
> constructor and destructor and simply inherits from the well established
> and highly tested Rb_zbs_DataClass. The g++ compiler has no trouble
> compiling this code.
> 
> My question is, what is the meaning of the above error message? It seems
> reasonable to declare an object of a type with no member functions.
> 
> Thank you for your help -- Sean
> 
> __________________________________________________________________________
> foo.C ====================================================================
> 
> void
> foo()
> {
>    gROOT->LoadMacro( "Foo.cxx" ) ;                 // Same as ".L Foo.cxx"
> 
>    const char* infile  = "fubar.root";
>    const char* outfile = "snafu.root";
> 
>    Foo Bar( infile, outfile );
> }
> 
> __________________________________________________________________________
> Foo.cxx ==================================================================
> 
> #include "Foo.hxx"
> 
> #ifdef __CINT__
> #include "Rb_zbs_DataClass.cxx"
> #endif
> 
> #if !defined(__CINT__) || defined(__MAKECINT__)
> #include <TCanvas.h>
> #include <TH1.h>
> #include <TFile.h>
> #include <TNtuple.h>
> #include <TProfile.h>
> #endif
> 
> #include <iostream>
> #include <fstream>
> 
> Foo::Foo( const char* infile, const char* outfile )  // Object Constructor
>    : Rb_zbs_DataClass( infile, outfile )
> {}
> 
> Foo::~Foo()                                          // Object Destructor
> {}
> 
> // Local variables:
> // compile-command: "g++ `root-config --cflags` -Wall -c Foo.cxx"
> // End:
> 
> __________________________________________________________________________
> Foo.hxx ==================================================================
> 
> #ifndef FOO
> #define FOO
> 
> #include "Rb_zbs_DataClass.hxx"
> 
> #if !defined(__CINT__) || defined(__MAKECINT__)
> #include <Htypes.h>
> #endif
> 
> class TH1F;
> class TCanvas;
> class TPad;
> 
> class Foo
>    : public Rb_zbs_DataClass
> {
>    public:
> 
>       Foo( const char* infile, const char* outfile );
>       virtual ~Foo();
> 
> 
> };
> 
> #endif // FOO
> 
> __________________________________________________________________________
> 
>                                Sean Walston
> --------------------------------------------------------------------------
> Willamette Hall, Office 317      SLD, Central Lab Annex, Office B-153
> Department of Physics            Stanford Linear Accelerator Center, MS-94
> University of Oregon             P.O. Box 4349
> Eugene, OR 97403                 Stanford, CA 94309
> walston@ampere.uoregon.edu       walston@SLAC.stanford.edu
> Office:  541-346-4847            Office:  650-926-8768
> Home:    541-686-9969            Mobile:  541-912-5456
> __________________________________________________________________________



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET