0

Why cannot a C++ library with Generics (ie. templates) be closed source ?

Suppose I want to make an object file for my library and provide only the implementation and the header file, what should i do ?

I understand that at the time of linking the compiler will be confused about the data type and hence this is not possible.

So isn't there any work-around that C++ provides for people who don't want to make their libraries open-source ?

How do other languages(Java) manage this ?

Rohith R
  • 1,309
  • 2
  • 17
  • 36
  • Java doest have templates. You must provide a header file for your library and a template must be implemented in the header. – Alex Lop. Sep 13 '15 at 12:52
  • Java has generics as far as i know. http://www.tutorialspoint.com/java/java_generics.htm – Rohith R Sep 13 '15 at 12:54

0 Answers0