0
Currently I need to create a collection of classes that represent nodes (fragments) of the AST (abstract syntactic tree) of an interpreter. Now, for example, I gave an overview of the C++ templates and tried to declare two members (left
and right
) for a class ASSIGNOP
, which would be both nodes.
#ifndef AST_H
#define AST_H
struct ast
{
template<typename T>
class ASSIGNOP
{
public:
T *left;
T *right;
}
} Ast;
#endif
I haven’t tested this code because I have to learn to use make yet...
So the problem is that the members of ASSIGNOP
are not considered nodes (still do not know much about templates). I need to make them be forced to be one of the classes within Ast
. How could I do that?