So if I have a header file like this:
template<typename T>
class snake
{
public:
void example();
private:
T *start_Ptr;
};
and then a source file like this:
#include <iostream>
#include <stddef.h>
#include "foo.h"
using namespace std;
template<class T>
struct node
{
T data;
node *next;
};
template<typename T>
void snake<T>::example()
{
node<int>* temp = start_Ptr;
cout<<"Does this work?";
}
void main()
{
snake<int> show;
show.example();
}
Why do I get this message?
error C2440: 'initializing' : cannot convert from 'int *' to 'node<T> *'
I know if I did something like node* start_Ptr=0; that would work but how would I do it with start_Ptr under private?