i cave this code

#include <iostream>
#include <cstdlib>
#include <cassert>

using namespace std;

typedef int typos_akmis;



template <class typos_stoixeiou>
struct korifi
{
	typos_stoixeiou dedomena;
       /* i would like to do korifi<typos_stoixeiou> * ->kdktis */
	korifi<typos_stoixeiou> * epomenos;   
       akmi<typos_stoixeiou>* kefali;   /* here is the problem */
	int episkeftike; 
} ;




template <class typos_stoixeiou>
struct akmi
{
	typos_akmis dedomena;  
	korifi<typos_stoixeiou> * akro;  
	akmi<typos_stoixeiou>* epomenos;
	int simadi; 
};



template <class typos_stoixeiou>
class grafos
{
    public:
	  typedef struct korifi<typos_stoixeiou> *kdktis;
          typedef struct akmi<typos_stoixeiou> *adktis;
	   typedef kdktis graphima;
           graphima G;
	public:
              //All the functions
};

can someone tell me a solution to bypass these problems?
Thank you very much

Recommended Answers

All 2 Replies

You need a forward decleration. Put this at the top of your file :

template <class typos_stoixeiou>
struct akmi;

template <class typos_stoixeiou>
struct korifi{ ...  }

Dude, i really wanna help but one rule you should always have in mind if u want to be a professional programmer is to simplify your code as best as possible, so i do not see any reason why you have to typedef int to some weird variable name when the word int is so preferrable compared to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.