Connecting Tech Pros Worldwide Forums | Help | Site Map

Instace of Derived Template

Newbie
 
Join Date: Sep 2007
Posts: 1
#1: Sep 26 '07
Hi All,
I am having problem i creating instance of derived Template. How can it be done?
Ex:
Expand|Select|Wrap|Line Numbers
  1. template <class T>
  2. class Base
  3. {
  4. --
  5. --
  6. };
  7.  
  8. template <class T1 = Base>
  9. class Derived
  10. {
  11. --
  12. -
  13. };
  14.  
  15.  
  16. void main()
  17. {
  18. Derived<Base> d1; //This is giving Compiler Error 
  19. }
  20.  
The Error is : Template Arguments are missing

THANKS
regards
vasu.

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,195
#2: Sep 26 '07

re: Instace of Derived Template


You have declared you derived class incorrectly do it like this
Expand|Select|Wrap|Line Numbers
  1. template <class T>
  2. class Derived: public Base<T>
  3. {
  4. --
  5. -
  6. };
  7.  
Reply


Similar C / C++ bytes