home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11237 < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.5 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
  3. From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
  4. Subject: Re: Help W/ Generics in C++
  5. Message-ID: <1992Jul21.152723.23194@ucc.su.OZ.AU>
  6. Sender: news@ucc.su.OZ.AU
  7. Nntp-Posting-Host: extro.ucc.su.oz.au
  8. Organization: MAXTAL P/L C/- University Computing Centre, Sydney
  9. References: <1992Jul20.132106.1@vmsb.is.csupomona.edu>
  10. Date: Tue, 21 Jul 1992 15:27:23 GMT
  11. Lines: 27
  12.  
  13. In article <1992Jul20.132106.1@vmsb.is.csupomona.edu> cvadrsvk@vmsb.is.csupomona.edu writes:
  14. >
  15. >
  16. >I am new to C++.  I have programmed in C for about 5 years and now want to 
  17. >use features of C++.  I have also programmed in Ada to a limited extent.
  18. >In Ada generic packages may be created.  Can someone assist me in describing 
  19. >how this is implemented in C++.  The application I am working on is the
  20. >implementation of a B+Tree System.  I would like to be able to hand a 
  21. >"generic" object the data structure for the records along with the operator to
  22. >compare the structure and have the internals of the file system completly
  23. >hidden.
  24. >
  25.  
  26.     Pretend you writing a class to make a B+Tree of T objects.
  27. Now just put
  28.  
  29. template<class T>
  30.  
  31. on the line before the class declaration.
  32. You also need to add <T> in various places to make it work.
  33.  
  34.  
  35. -- 
  36. ;----------------------------------------------------------------------
  37.         JOHN (MAX) SKALLER,         maxtal@extro.ucc.su.oz.au
  38.     Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
  39. ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
  40.