TRoot::void *operator new

William J Deninger (deninger@uiuc.edu)
Fri, 27 Feb 1998 15:01:40 -0600


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01BD4390.9BA89430
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hello,

I seen that TRoot inherits TDirectory which is a TObject. Why then does =
TRoot have its own operator new implementation which calls that of =
TObject?

TObject.h...
class TObject {
...
void *operator new(size_t sz) { return TStorage::ObjectAlloc(sz); =
}
void *operator new(size_t sz, void *vp) { return =
TStorage::ObjectAlloc(sz, vp); }
...
}
TRoot.h file...
class TRoot : public TDirectory {
...
void *operator new(size_t l) { return TObject::operator =
new(l); } // is this needed?
...
}
Just curious,
William J Deninger
deninger@uiuc.edu

------=_NextPart_000_0007_01BD4390.9BA89430
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">

Hello,
 
I seen that TRoot inherits TDirectory which is a=20 TObject.  Why then does TRoot have its own operator new = implementation=20 which calls that of TObject?
 
TObject.h...
class TObject = {
...
   void    *operator = new(size_t sz) {=20 return TStorage::ObjectAlloc(sz); }
   = void   =20 *operator new(size_t sz, void *vp) { return TStorage::ObjectAlloc(sz, = vp);=20 }
...
}
TRoot.h file...
class TRoot : = public=20 TDirectory {
...
  =20 void           = *operator=20 new(size_t l) { return TObject::operator new(l); }   // is = this=20 needed?
...
}
Just curious,
William J Deninger
deninger@uiuc.edu
------=_NextPart_000_0007_01BD4390.9BA89430--