   Error, help resolving
  I'm usually good with error, but sometimes I get confuzzled. This is the error :error C2440: '=' : cannot convert from 'overloaded-function' to 'Grid3D::heightFunction'Here is the relevant code. void Grid3D::resetGrid(const int constHeight){heightFunc = &Grid3D::defaultHeight<constHeight>; //Error occurs here}//Type is a typedef to float, this is the only template function in Grid3D classtemplate<int staticHeight>static Type defaultHeight(Type x, Type z){   return staticHeight; }If I change the error line to , defaultHeight<0> or some integral compile timeknown integer then it works. But having it runtime causes the error. This is the definition for heightFunc :typedef Type(*heightFunction)(Type,Type);heightFunction heightFunc;Here is the complete code if needed, but I showed whats relevant above ://Grid3D.h#ifndef GRID3D_H_#define GRID3D_H_#include &lt;vector&gt;using std::vector;class Grid3D{public:typedef float Type;typedef const float constType;typedef std::vector&lt;Type&gt; GridType;private:typedef Type(*heightFunction)(Type,Type);unsigned ROW;unsigned COL;GridType heightGrid;heightFunction heightFunc;public:Grid3D(const unsigned size = 32,const heightFunction hF = defaultHeight&lt;0&gt;);void render()const;void resetGrid(const int newStaticHeight = 0);private:void _initGrid(const unsigned size);unsigned _transformIndex(int row, int col)const;template&lt;int staticHeight&gt;static Type defaultHeight(Type x, Type z){ return staticHeight; }};#endif//Grid3D.cpp#include "Grid3D.h"#include &lt;GL/glut.h&gt;Grid3D::Grid3D(const unsigned size,heightFunction hFunc): ROW(size), COL(size), heightFunc(hFunc){_initGrid(size);}void Grid3D::render()const{const float shift = ROW * 0.5f;glBegin(GL_QUADS);for(unsigned i = 0; i &lt; ROW; ++i){for(unsigned j = 0; j &lt; COL; ++j){glVertex3f(i-shift, heightGrid[_transformIndex(i,j)] , j); //Top leftglVertex3f(i+1-shift, heightGrid[_transformIndex(i+1,j)] , j); //Top rightglVertex3f(i+1-shift, heightGrid[_transformIndex(i+1,j+1)] , j+1); //Bottom rightglVertex3f(i-shift, heightGrid[_transformIndex(i,j+1)] , j+1);//Bottom left}}glEnd();}void Grid3D::resetGrid(const int constHeight){heightFunc = &Grid3D::defaultHeight&lt;constHeight&gt;;}//private helpersvoid Grid3D::_initGrid(const unsigned size){heightGrid = GridType(size*size,0);for(unsigned i = 0; i &lt; ROW; ++i){for(unsigned j = 0; j &lt; COL; ++j)heightGrid[ _transformIndex(i,j) ] = (*heightFunc)(i,j);}}//transform 2d indices into 1dunsigned Grid3D::_transformIndex(int row, int col)const{col %= COL;row %= ROW;return ROW*row + col;}Thanks for the help.   
  First, yeah you won't be able to do this:void Grid3D::resetGrid(const int constHeight){heightFunc = &Grid3D::defaultHeight<constHeight>;}because obviously you can't decide what template to instantiate at runtime. constHeight is a constant, but only at runtime.Second, I'm not sure why doing something like this:void Grid3D::resetGrid(const int constHeight){heightFunc = &Grid3D::defaultHeight<0>;}would give you a runtime error. It seems like it would work, but I'm not a template expert. What was the runtime error?-Danny   ;  Instead of:void Grid3D::resetGrid(const int constHeight){You need:template<int constHeight> void Grid3D::resetGrid(){;  >>Second, I'm not sure why doing something like this{...}would give you a runtime error.I am sorry. That does not give an compile error. It works that way.>>Instead of:void Grid3D::resetGrid(const int constHeight){You need:template<int constHeight> void Grid3D::resetGrid(){Yea, that was my last option. I was trying to make the syntax better, IMO.Thanks both for the response   