having created classes in different files i want to link these classes with the main function written in some other file (all of these files exist in a single project in codeblocks).i am unable to link these files also if writing header is the solution then what all elements to include in the header. my main function is as
#include <iostream>
#include "linkedlist.h"
using namespace std;
int main()
{
linkedlist<int> obj1;
obj1.create();
obj1.add_node_at_beginning(10);
obj1.add_node_at_beginning(20);
obj1.add_node_at_beginning(30);
}
all of these functions are defined in linkedlist class which has a template my header file is
#ifndef LINKEDLIST_H_INCLUDED
#define LINKEDLIST_H_INCLUDED
template <class N>
struct Node
{
Node<N> *ptr_to_nxt_node;
N data;
};
template <class LL>
class linkedlist
{
Node<LL> *strt;
Node<LL> *end;
int n;
Node<LL> *nde;
public:
linkedlist();
void create();
void add_node_at_beginning(LL dat);
void add_node_at_end(LL dat);
};
#endif // LINKEDLIST_H_INCLUDED