template parameters cannot be friends

Eljay Love-Jensen eljay@adobe.com
Fri May 21 15:45:00 GMT 2004


Hi Naje,

 >i do not need put method draw in Window's children.

- - - - - - - - - - - - - - - - - - - - -
#include <iostream>

using namespace std;

class Window
{
public:
     void Draw() const
     {
         cout << "Window::Draw" << endl;
     }
};

class BoxWindow : private Window
{
public:
     using Window::Draw;
};

template <typename T>
void Draw(T const& object)
{
     object.Draw();
}

int main()
{
     BoxWindow box;
     Draw(box);
}
- - - - - - - - - - - - - - - - - - - - -

HTH,
--Eljay



More information about the Gcc-help mailing list