GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Mar-2005, 05:21
if13121 if13121 is offline
New Member
 
Join Date: Oct 2004
Posts: 27
if13121 is on a distinguished road

beginner::friend template class


i 'm creating class list
but i got compiler message List is not a template class.


CPP / C++ / C Code:
template <class Type> class GElmt{
 public:
     friend class List <Type>;
/*CUT*/
 private:
Type info;
      GElmt *next;
}

template <class Type> class List
{
public:
    private:
    GElmt <Type> *First;
    /*CUT*/
}; 


is this ok?
friend class List <Type>;
  #2  
Old 04-Mar-2005, 05:56
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 917
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Heheh, you changed the order:

CPP / C++ / C Code:
//friend class List <Type>;
template <class Type> friend class List;

This should be OK...

Kind regards,
Lucian

[edit]
Also, I'm not sure why you didn't end your first class' definition with ;. You should have gotten an error about that.
[/edit]
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 3) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help on how to reload ostream operator in a template class eggie C++ Forum 4 07-Feb-2005 17:14
Error C2146: syntax error : missing ',' before identifier 'C4' mattchew008 C++ Forum 2 19-Dec-2004 06:06
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 03:38
hashing help saiz66 C++ Forum 1 06-Jul-2004 06:16

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:21.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.