Author: Anthony Cozzie
Date: 16:29:51 09/22/03
Go up one level in this thread
On September 22, 2003 at 17:42:28, Bo Persson wrote: >On September 22, 2003 at 13:45:03, Anthony Cozzie wrote: > >> >>You are going to have a hard time convincing me that > >I'm not trying to, I just like it much better myself. > >> >>class a >>{ >>public: >> foo1(); >> foo2(); > >I would of course also have some data here > >private: > piece moved_piece; > square from; > square to; > > >>}; >> >>is better than: >> >>struct a; >> >>foo1(a*, ...); >>foo2(a*, ...); >> >>etc. > >One obvious problem is that anyone can write > >void garble(a*, ...); > >that messes with the data. In the C++ case, this is not allowed. > >With a struct, someone (anyone!) can also write In principle (and especially for large projects) I agree with you. But in this particular case, someone = anyone = me ;) anthony >a_value.from = a7; > >and destroy the abstraction. Of course you would never do that, not even by >mistake... > >> >>To me these are the same. If you prefer the C++ syntax, that is of course your >>option, of course. > >It's not just the syntax, it is also the added abstraction of a being a value >type, not just a parameter that you pass around all the time. > > >Bo Persson > >> >>anthony
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.