C and C++ are almost convertible, in that in C++ one can write

myPicture->colourBalance(rValue, gValue, bValue);     // random example

while in C one would write

colourBalance(myPicture, rValue, gValue, bValue);

which is also good C++. Most interface things can be translated in this way.

The only real difference is polymorphism ie what if myPicture could be
either a JpegPicturePtr, a TiffPicturePtr or a PngPicturePtr? In C++ one
would subclass all these from PicturePtr and create a virtual method
colourBalance. In C one does have several options (eg variants) but they do
not translate well into C++.

As to Mark's earlier comments about 'lots of switches', his example is not
the best in that somewhere in a C++ program one does need some switching
code for creating objects of the concrete class. But anyway, what is wrong
with switches?
-- 
Regards,
Martin
([EMAIL PROTECTED])
IT: http://methodsupport.com Personal: http://thereisnoend.org

Reply via email to