Click here to Skip to main content
15,908,274 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: template class inheritance issue Pin
George_George21-Sep-08 19:52
George_George21-Sep-08 19:52 
GeneralRe: template class inheritance issue Pin
CPallini21-Sep-08 21:43
mveCPallini21-Sep-08 21:43 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 22:16
George_George21-Sep-08 22:16 
GeneralRe: template class inheritance issue Pin
CPallini21-Sep-08 22:44
mveCPallini21-Sep-08 22:44 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 23:01
George_George21-Sep-08 23:01 
AnswerRe: template class inheritance issue Pin
Malli_S21-Sep-08 19:36
Malli_S21-Sep-08 19:36 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 19:55
George_George21-Sep-08 19:55 
GeneralRe: template class inheritance issue Pin
Malli_S21-Sep-08 20:06
Malli_S21-Sep-08 20:06 
You're right George, template expansions are done are compile time. I was just giving you thought that it's not just the replacement. The template instantiations are done when compiler comes across the class template's object declaration. In case of

template <class t="">
class Abc
{
     T m_iVariable;

     ...

};

int main()
{
   ...
   Abc <int> objInt;
   Abc <double> objDouble;
   ...

   Abc <int> objInt2;
}</int></double></int></class>


when the compiler comes across the statements

Abc <int> objInt;
   Abc <double> objDouble;</double></int>


it generates the code for respective data types, which is called as template instantiating. These instants (generated code) persists through you program within it's scope. i.e. no more template instance is generated for 'objInt2' as the 'int' version of the template is already in exist.

-Malli...! Rose | [Rose]

GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 20:34
George_George21-Sep-08 20:34 
GeneralRe: template class inheritance issue Pin
SandipG 21-Sep-08 21:32
SandipG 21-Sep-08 21:32 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 22:14
George_George21-Sep-08 22:14 
GeneralRe: template class inheritance issue Pin
SandipG 21-Sep-08 22:51
SandipG 21-Sep-08 22:51 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 23:04
George_George21-Sep-08 23:04 
GeneralRe: template class inheritance issue Pin
SandipG 21-Sep-08 23:21
SandipG 21-Sep-08 23:21 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 23:32
George_George21-Sep-08 23:32 
GeneralRe: template class inheritance issue Pin
SandipG 21-Sep-08 23:34
SandipG 21-Sep-08 23:34 
GeneralRe: template class inheritance issue Pin
George_George22-Sep-08 0:10
George_George22-Sep-08 0:10 
GeneralRe: template class inheritance issue Pin
SandipG 22-Sep-08 0:12
SandipG 22-Sep-08 0:12 
GeneralRe: template class inheritance issue Pin
George_George22-Sep-08 1:05
George_George22-Sep-08 1:05 
GeneralRe: template class inheritance issue Pin
SandipG 22-Sep-08 1:45
SandipG 22-Sep-08 1:45 
GeneralRe: template class inheritance issue Pin
George_George22-Sep-08 1:52
George_George22-Sep-08 1:52 
GeneralRe: template class inheritance issue [modified] Pin
SandipG 22-Sep-08 1:55
SandipG 22-Sep-08 1:55 
GeneralRe: template class inheritance issue Pin
George_George22-Sep-08 3:21
George_George22-Sep-08 3:21 
GeneralRe: template class inheritance issue Pin
Malli_S21-Sep-08 22:00
Malli_S21-Sep-08 22:00 
GeneralRe: template class inheritance issue Pin
George_George21-Sep-08 22:15
George_George21-Sep-08 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.