Not defined member function in class template

Ask a question+

I have this code

template<class T>
struct Z
   void f() {}
   void g(); // never defined

int main()
   Z<int> a;
   Z<char>* p;

   return 0;

It compiles and runs.

What I don’t understand is how it works if member function g() is not defined. Only when I call g() it gives linage error.

Tigran 1.1K
add comment

0 Answer

Your Answer