cross-platform c++ classes?

David Demland plug-devel@lists.PLUG.phoenix.az.us
Mon May 21 12:09:11 2001


What you are after is common to want to do. In many cases true platform
independent code is required is you want the same look and feel on different
platforms. For example, FrameMaker looks and feels basically the same no
matter what platform it is running on (Windows, Mac, or Unix). To achieve
this type of portability the code must be written right.

Having higher level objects that do the actual work without any interfaces
(I/O) is the best approach. Let me give an example of how this can be done.

I am creating a blackjack program. There are five objects to this program:
Card, Deck, Hand, Player, and Dealer. Most of the work each does can be
figured out pretty easy. I'll look at just one of the objects for now the
Dealer. The Dealer is a inherited class from Player. This is because the
Dealer is nothing more than a super player so to speak.

The Dealer must be able to show that cards that have been dealt out to all
the players. So this object has a method on it called DisplayAll(void). It
would be easy to place all the display code in this method. If this is done
then this code is tied to one platform. To solve this problem, the
DisplayAll(void) method calls a function called DisplayCard(Card &P_card).
This function takes the card passed in and then displays it. This function
is in a library that holds all the low level display functions. This way to
replace how these functions work and re-linking the program can have
different displays. This will allow a library for Win32, X, Mac, DOS, and
Unix console output without effecting the blackjack application code.

It is simple to do. Just remember to separate the process from display. This
will allow a platform independent application with a small display library
only. This type of programming allows for the application for become more of
a "middleware" type of application. This is one of the key points of the
case against Microsoft about how they want to eliminate "middleware" just to
ensure that users are on the WinTel platform.

Thank You,

David Demland
Qa/Process Manager
CADTEL Systems, Inc.
11201 N. Tatum Ste. 200
Phoenix, AZ 85028
(602) 648-6054
Fax: (602) 953-4833
ddemland@cadtel.com

-----Original Message-----
From: plug-devel-admin@lists.PLUG.phoenix.az.us
[mailto:plug-devel-admin@lists.PLUG.phoenix.az.us]On Behalf Of Lucas
Vogel
Sent: Tuesday, May 22, 2001 11:40 AM
To: Plug-Devel (E-mail)
Subject: cross-platform c++ classes?


I am looking to create a development library based on a cross-platform API.
The way I would like to develop my library would be to create a "core set"
of c++ classes, with platform-specific implementations(i.e., a COM subset
for windows) based on these core classes. The API that I am developing off
of is implemented on Windows, (Red Hat) Linux and SGI(IRIX I think).

My question to the council is, how do I create this core set of classes so
that they are also cross-platform compatible? Any and all
recommendations/suggestions would be greatly appreciated.

Thanks guys!

===========================
Lucas Vogel
lvogel@exponent.com
623-587-6739	work
623-587-4191	fax
===========================



_______________________________________________
PLUG-devel mailing list  -  PLUG-devel@lists.PLUG.phoenix.az.us
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel