home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!tdat!swf
- From: swf@teradata.com (Stanley Friesen)
- Newsgroups: comp.windows.open-look
- Subject: Re: Q: C++ and callback problems.
- Keywords: callback OI
- Message-ID: <982@tdat.teradata.COM>
- Date: 2 Sep 92 21:58:36 GMT
- References: <Btpy3G.Dnu@solbourne.com> <1992Aug30.171624.1330@isy.liu.se>
- Sender: news@tdat.teradata.COM
- Reply-To: swf@tdat.teradata.com (Stanley Friesen)
- Organization: NCR Teradata Database Business Unit
- Lines: 25
-
- In article <1992Aug30.171624.1330@isy.liu.se> svan@isy.liu.se writes:
- |>
- |> // call MyClass::bar when button activated
- |> cellp->change_action( mcp, (OI_action_memfnp) &MyClass::bar );
- |
- |What is OI_action_memfnp? For this to be a legal and portable (?) cast it
- |has to be of type pointer-to-member-of-MyClass or a pointer-to-member-of-a-
- |-baseclass-of-MyClass.
- |I suppose in this case that MyClass is derived from an OI-class? (hence the
- |lacking of a cast of mcp in the last call.) Is it really safe to make a
- |member-function-call when both the objectpointer and the pointer-to-member-
- |-function have been casted "towards the baseclass"?
-
- You suppose correctly. To register a member function as a callback, the
- first base class of MyClass must be the OI class OI_callback.
-
- And, no, it is not safe, you had better be sure that the member function
- pointer you are passing actually pertains to the object pointer you are
- passing.
-
-
- --
- sarima@teradata.com (formerly tdatirv!sarima)
- or
- Stanley.Friesen@ElSegundoCA.ncr.com
-