Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: Template pr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 9 Topic 45795 of 47017
Post > Topic >>

Re: Template problems

by "sk_usenet" <sometechyguy at gmail dot com> May 7, 2008 at 09:35 AM

"Tim Frink" <plfriko@[EMAIL PROTECTED]
> wrote in message

[snip]
> During compilation I get the error
> undefined reference to `void A::func<B>(bool (B::*)())'.
>
> The problems seem to be that during compilation of class B, the
> template function A::func is not completely known (just the
> function declaration of the header file, but not the function
> definition). I assume that one solution is to move the function
> body of A::func into the header file a.h to make it visible during
> compilation of class B.
>
> However, this seems not to be the best solution because I must
> reveal the implementation of A::func to anyone who wants to use
> it. Without templates, I could compile class A into a library
> and just provide the header file a.h together with the library.
> So, the users would not see the implementation of class A.
> However, when I move code from the source file into the header
> file, I show my implementation which I would like to avoid.
> Are there any solutions for that? Or are templates in general
> crucial when source code must be kept closed?

Check this FAQ --  
http://www.para****ft.com/c++-faq-lite/templates.html#faq-35.14

-- 
http://techytalk.googlepages.com
 




 9 Posts in Topic:
Template problems
Tim Frink <plfriko@[EM  2008-05-07 16:04:49 
Re: Template problems
"sk_usenet" <  2008-05-07 09:35:09 
Re: Template problems
Puppet_Sock <puppet_so  2008-05-07 09:39:05 
Re: Template problems
"Victor Bazarov"  2008-05-07 12:58:24 
Re: Template problems
Stephan Ceram <linuxka  2008-05-07 17:28:44 
Re: Template problems
"Victor Bazarov"  2008-05-07 13:41:35 
Re: Template problems
Joe Greer <jgreer@[EMA  2008-05-07 21:08:27 
Re: Template problems
Tim Frink <plfriko@[EM  2008-05-07 21:51:07 
Re: Template problems
Joe Greer <jgreer@[EMA  2008-05-08 20:17:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 15:59:35 CDT 2008.