I'm late too. Pretty sure you can do operator overriding that in C# as well. *ducks and looks both ways for flying bricks*
:-) Matthew Small wrote: >I know I'm coming in late on this one, but operator overriding and deep copy >are features of C++. Now I'll read the rest of the responses. :-) > >- Matt Small > >-----Original Message----- >From: Marlon Moyer [mailto:[EMAIL PROTECTED] >Sent: Friday, April 22, 2005 10:26 PM >To: CF-Community >Subject: I'm in love with Ruby > >Ok, maybe not real love, but I sure am in lust with this language. >The more I read about it and it's syntax, I believe this could >possibly be the most beautiful programming language in existence. > >Take for exampe this code snippet. > >temp = a; >a = b; >b = temp; > >written in Ruby would be > >a,b = b,a > >Succinct and to the point isn't it? Another really cool feature is >that everything is an object. Even though a simple arithmetic >statement is written like this: > >a+b*c > >it's actually this > >(a.+ b).* c > >+, *, /, etc are actually methods of objects. So, what's the use? >Well, you can override any method in Ruby, ANY method. Don't like the >way it multiplies, change it. Not very useful, but it really shines >in situation like presented in my Programming Ruby book. Say you have >a song object that encapsulates a lot of information about a single >song. You want to have a function that will play a snippet of that >song. You can create a method named [] that will override the index >method usually applied to arrays. Then you could reference it by >song[0,15].play. The song[0,15] would return a new song with a 15 >second duration and then send it to your generic play method. > >One other thing that I really think is neat is the ability to define >mutator methods. By default, methods work on a copy of the arguments >passed in, if you name your methods ending with a '!', the method will >work on the argument itself. So, obj.chop would be a nonmutator, >obj.chop! would be and modify the passed in values. I like directness >of this. > >Okay, enough of my Ruby soapbox. Go back to your weekends people. >What the hell are you doing on your computers this time of night. > >Marlon > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Purchase Studio MX with Flash Pro from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://www.houseoffusion.com/banners/view.cfm?bannerid=51 Message: http://www.houseoffusion.com/lists.cfm/link=i:5:155192 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
