Monday, October 10, 2005

Forward declaration of a template class.

Forward declaration of a template class.

This issue confused me a little bit when I try to declare a template-based class as a friend class of another class.

The issue is like this:

<template class T>
Class A
{
Public:
Private:
}

Class B
{
Public:
Private:
     int m_b;
}

And Class A wants to access the private member m_b in Class B, the forward declaration of A will be like this:
template <class T>  class A

No comments: