TObjArray arr; arr.Add(new TGraph()); arr.Add(new TH1F("h1", "histogram", 100, 0, 10)); Int_t nEntries = arr.GetEntriesFast();In the above example, we create a TObjArray named arr and add two objects of different types to it (a TGraph and a TH1F). We then call the GetEntriesFast() function to get the number of objects stored in the array and assign it to the variable nEntries. The TObjArray class is part of the ROOT package library.