delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/28/11:30:53

From: BlackSwordQB <blackswordqb AT my-dejanews DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: bug I can't find (new c++ programmer)
Date: Sun, 28 Mar 1999 15:53:07 GMT
Organization: Deja News - The Leader in Internet Discussion
Lines: 17
Message-ID: <7dlj91$600$1@nnrp1.dejanews.com>
NNTP-Posting-Host: 207.115.58.80
X-Article-Creation-Date: Sun Mar 28 15:53:07 1999 GMT
X-Http-User-Agent: PRODIGY-WB/WIN32/3.4h
X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 207.115.58.80
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

umm... I'm just a beginning C/C++ programmer, and I was wondering if anyone
could help me with a program I tried to make from an example from the book I
learned C from about templates (no the bug ISN'T becuase it's out of my
league, since I said beginning C/C++ not beginning programmer.), and after
debugging for about an hour, I finally got it to compile. but, it didn't work
right here is the source (I'm not a good commenter):// Linked Lists// by:
BlackSwordQB#include <iostream.h>template <class T>class Data{public: Data(T
Val):itsValue(Val){} T GetValue(){return itsValue;} void SetValue(T
newVal){itsValue=newVal;}private: T itsValue;};template <class T>class
Node{public: Node(){} virtual T GetValue(int num)=0; virtual Node<T>
*Insert(T *)=0;};template <class T>class DataNode: public Node<T>{public:
virtual T GetValue(int num) { if (num == itsNumber) return
itsData->GetValue(); return itsNext->GetValue(num); } DataNode(T val, Node<T>
* n

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019