Thread: how to derive from class with templates

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    6

    how to derive from class with templates

    Hi,
    How do i derive from the vector class?
    I wrote this but it is not correct for sure.

    Code:
    template <class T, class Allocator = allocator<T> > class DataBlock 
    : vector <T,Allocator >  {
    	//some more functions
    
    };
    thanks

  2. #2
    Registered User
    Join Date
    Jan 2008
    Posts
    6
    Ok I found it.
    sorry for the post

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    You don't, actually. vector is not designed to be derived from. If you want to add functionality, write free functions.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inherite nonvirtual class functionality
    By DrSnuggles in forum C++ Programming
    Replies: 2
    Last Post: 04-30-2009, 01:52 PM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. class templates...
    By Anddos in forum C++ Programming
    Replies: 1
    Last Post: 03-17-2006, 09:30 PM
  4. Class Templates and member functions
    By Mr_roboto in forum C++ Programming
    Replies: 7
    Last Post: 02-22-2006, 10:46 PM
  5. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 02:33 PM