I have this class which has a double list template of a struct of two chars and another struct
typedef struct KeyC{
char K[5];
char C[9];
} TKeyC;
typedef struct Bin{
char Car;
char Cad[9];
TKeyC *KC;
} TBin;
class Bo {
private:
TDoubleList<TBin> *Ent;
public:
...
}
I have a method to create nodes. No problem with this, but when I call other method to modify the direction of the pointer to a new TKeyC struct this simply doesn't happen.
TNode<TBin> *Aux;
TKeyC *AuxKC=new TKeyC;
Aux->getObj().KC=AuxKC;
Do I have to use a class instead of a struct in this case or is a problem of structs or there is a bug in it?
Update
template <class T>
class TNode
{
private:
T TObj;
TNode<T> *Prev,*Next;
public:
TNode();
~TNode();
TNode(T);
void setObj(T);
void sPrev(TNode<T>*);
void sNext(TNode<T>*);
T getObj();
TNode<T>* gPrev();
TNode<T>* gNext();
};
And the method getObj:
template <class T>
T TNode<T>::getObj() {return(TObj);};