Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!ncrlnk!ncratl!dwithers From: dwithers@ncratl.Atlanta.NCR.COM (Dave Witherspoon) Newsgroups: comp.lang.c++ Subject: Re: Detecting the first object? Summary: There is a way... Message-ID: <498@ncratl.Atlanta.NCR.COM> Date: 21 Aug 90 14:32:13 GMT References: <1120006@hpvcfs1.HP.COM> Organization: NCR Engineering & Manufacturing Atlanta -- Atlanta, GA Lines: 16 In article <1120006@hpvcfs1.HP.COM>, ericr@hpvcfs1.HP.COM (Eric Ross) writes: > I am creating a set of classes the will access the Network Computing > System (NCS) and a signal handler needs to be initialized exactly one time. > > Is there a way for an object to know that it is the first instantiation of > a class? My gut feel is that there is a way with static members, but I don't > quite have the right recipe. You're on the right track. What I have done is provide for a static class counter, and every trip through the constructor I bump it check for a value of 1. Although this seems to be of a "manual" nature, it works. -------------------------------David Witherspoon------------------------------- David.Witherspoon@Atlanta.NCR.COM | NCR E&M Atlanta: (404) 623-7713 | Visualize Whirled Peas MY OPINIONS...ALL MINE!!! |