Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!att!cbnewsl!dog From: dog@cbnewsl.ATT.COM (edward.n.schiebel) Newsgroups: comp.lang.c++ Subject: Re: When to make member functions? (long) Summary: Yes, there are "class methods" in c++ Keywords: member functions, c++ Message-ID: <1745@cbnewsl.ATT.COM> Date: 2 Sep 89 23:37:25 GMT References: <1267@pc.ecn.purdue.edu> <2506@fai.UUCP> <565@hsi86.hsi.UUCP> <1254@tukki.jyu.fi> Organization: AT&T Bell Laboratories Lines: 53 In article <1254@tukki.jyu.fi>, sakkinen@tukki.jyu.fi (Markku Sakkinen) writes: > In article <569@hsi86.hsi.UUCP> wright@hsi.com (Gary Wright) writes: > -In article <1230@tukki.jyu.fi> markku@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) writes: > ->In article <565@hsi86.hsi.UUCP> wright@hsi.com (Gary Wright) writes: > ->-In article <2506@fai.UUCP> kurtl@fai.fai.com (Kurt Luoto) writes: > -> ... > - ... > ... > > C++ does not have a concept similar to the deferred classes of Eiffel; > such an effect must be simulated by programming discipline. Not exactly. Pure virtual fuctions are provided in Release 2.0: class AbstractBaseClass { public: virtual int f() = 0; }; AbstractBaseClass::f is a pure virtual function. Any attempt to call it is an error, and an instance of AbstractBaseClass may not be created. Any class derived from AbstractBaseClass must either restate the pure virtual declaration or provide an implementation. > ... stuff deleted... > I would prefer to make GRAPH_QUERY a module or package of functions > that take an additional GRAPH argument (in comparison to the above approach); > a function like short_path that takes two NODE arguments would probably > not need even that addition. Unfortunately, there is no module/package > concept in C++, nor are there class functions (corresponding to > Smalltalk's class methods) although there are "static data members" > (corresponding to class variables). In 2.0, there are static member functions as well: class foo { public: static void g(); }; foo::g is invoked just like that: foo::g(); It is not associated with any particular foo, and there is no "this" within its body. This doesn't have a whole lot to do about the discussion, but I thought the details were important. Ed Schiebel AT&T Bell Laboratories 201-386-3416