Month

Brief Information about the March 98 CSIG Meeting

C++ TEMPLATES by Michael Redlich


Leader: Bruce Arnold (b a r n o l d @ b l a s t . n e t)

Summary by: Ron Murawski (the_murs@pipeline.com)


User Group News

C/C++ User Group

The March C/C++ meeting, on the third Tuesday of the month, began with a Random Access period of questions and answers. The low price of upgrading to a 200 MHz Pentium motherboard/CPU was mentioned. PKZIP for Windows was demonstrated briefly. Questions of LexMark printers supporting HP PCL language, using Java with C++, and USB usage were also bandied about.

The most interesting question was by a member having difficulty with some C++ code. As group leader Bruce Arnold attempted to compile the code in question, knowledgeable members began to look for errors. It wasn't long before Michael Redlich pointed out the error: a mistake in capitalization. 'Public' is not a reserved keyword but 'public' is. The program was an example of simple inheritance of a 'rectangle' class from a 'square' class with a virtual function overide. This program became a discussion point as some programmers asked questions and others gave answers about every aspect of this 30 line program.

Michael Redlich then did the main presentation. Mike's theme was C++ templates. To introduce his topic he presented a program to swap items of different types. The first version required overloading the swap function for each data type. In all, 5 similar functions were required to swap the 5 different types of data. In his second program, by using templates, only one function was required.

With this introduction out of the way, Mike then went on to a full discussion of a template-based queue data structure container class. The code was from a December 1994 C/C++ User Journal magazine article by Dan Saks called: "Designing Generic Container Classes, Part 6: Templates". The class constructor and destructor, and the append, remove and clear member functions were presented. The nested public iterator class was explained. Mike demonstrated and discussed his own program which used the templatized queue class as well.

Mike's use of the Borland constream classes and methods for console output were of interest to several members. The night ended in discussing his use of these functions. The source code and executables are avialable from the ACGNJ ftp server:

See SOURCE CODE links below.


The following is an advertisement from Eric Salamon of TPD Publishing

(Note: this is NOT an ACGNJ or CSIG activity.)


Visual C++ Developers Conference

Attn: Amateur Computer Group of New Jersey members:

Visual C++ Developers Conference
April 15-17, 1998
Boston, Marriott Copley
$150 AC GNJ discount

As a member of the AC GNJ, register now for the fourth Visual C++
Developers Conference, presented by TPD Publishing, Inc. and Microsoft and
save $150!

Join hundreds of your colleagues for three days of intense technical
instruction from top Microsoft product gurus and cutting edge third party
speakers and authors.  You'll hear about the strategic direction of Visual
C++, see previews of new technologies, and get the latest information on:

* COM, DCOM, and COM+
* MFC, STL, and ATL
* MTS and MSMQ
* Hardcore Visual C++
* NT 5.0 and much more

To register now and receive the special user group dicount of $150, mention
offer code "UG4", and contact us at:
http://www.vcdj.com/vcdc
Phone: 800/811-3486 or 203/261-1943
Fax: 203/261-2289


Eric Salamon
TPD Publishing
1300 Dexter Avenue N
Suite 500
Seattle, WA 98109
888/811-2266
www.vcdj.com

"Random Access" questions start at 7:30 Tuesday night.

SOURCE CODE

Source Code Files

For help, email me at b a r n o l d @ b l a s t . n e t
Back to C++ Main Page