Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. about template

about template

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rxgmoral
    wrote on last edited by
    #1

    about template i create template class <<<<>>>>>>> template struct CTDbNode { T Data; CTDbNode(T Value):Data(Value){} }; <<<<<<>>>>>>>>>> #pragma once #include "m_TemplateData.h" templateclass CTDbList { public: CTDbList() { pCurrent=NULL; } void CTInsert(T Value) { pCurrent=new CTDbNode(Value); } public: CTDbNode *pCurrent; }; example CTDbList d; d.CTInsert(_T("ddd")); error: e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2955: 'CTDbNode' : use of class template requires template argument list e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' e:\mystudio\project\shared\shared\m_templatestructure.h(11) : while compiling class template member function 'void CTDbList::CTInsert(T)' with [ T=CString ] e:\mystudio\project\shared\shared\cm_selectquery.cpp(6) : see reference to class template instantiation 'CTDbList' being compiled with [ T=CString ] e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2514: 'CTDbNode' : class has no constructors e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' thank:)

    S 1 Reply Last reply
    0
    • R rxgmoral

      about template i create template class <<<<>>>>>>> template struct CTDbNode { T Data; CTDbNode(T Value):Data(Value){} }; <<<<<<>>>>>>>>>> #pragma once #include "m_TemplateData.h" templateclass CTDbList { public: CTDbList() { pCurrent=NULL; } void CTInsert(T Value) { pCurrent=new CTDbNode(Value); } public: CTDbNode *pCurrent; }; example CTDbList d; d.CTInsert(_T("ddd")); error: e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2955: 'CTDbNode' : use of class template requires template argument list e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' e:\mystudio\project\shared\shared\m_templatestructure.h(11) : while compiling class template member function 'void CTDbList::CTInsert(T)' with [ T=CString ] e:\mystudio\project\shared\shared\cm_selectquery.cpp(6) : see reference to class template instantiation 'CTDbList' being compiled with [ T=CString ] e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2514: 'CTDbNode' : class has no constructors e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' thank:)

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      Tick the "Ignore HTML tags in this message" button when you post: none of the the "<" or ">" characters can be seen in you post and it's poorly formatted. Steve

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups