Newsgroups: comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!zombie.ncsc.mil!news.duke.edu!news-feed-1.peachnet.edu!gatech!swrinde!howland.reston.ans.net!ix.netcom.com!netcom.com!milod
From: milod@netcom.com (John DiCamillo)
Subject: Re: Smalltalk @ Operator in C++
Message-ID: <milodD5KGus.sp@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <3k7rdd$drs@News1.mcs.com>
Date: Fri, 17 Mar 1995 04:08:51 GMT
Lines: 28
Sender: milod@netcom11.netcom.com
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:117983 comp.lang.smalltalk:21834

jim.fleming@bytes.com (Jim Fleming) writes:


>How do I convert Smalltalk programs that heavily use the @ method
>selector to C++?

>The @ method selector is used for class Integer to create objects
>of class Point, which have an x and y coordinate. For example,
>a := 150 @ 200. sends the Integer (with a value of 150) a message
>with a method selector of @, the other Integer argument (with value 200),
>is passed with the message to the receiver, 150. The @ method creates
>a new Point object and returns it and a reference is saved in "a".

>How do I do this in C++?

I don't know how *you* would do this in C++, but I would do it:

   TPoint a(150,200);

Of course, this is somewhat dependent on the particular class
library I choose to use for a given project.  The same code might
also be implemented in other ways.

-- 
    ciao,
    milo
================================================================
    John DiCamillo                        Pinin' for the fjords?
    milod@netcom.com                  What kind of talk is that?
