0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by tkud
0

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{ ...  }

Edited by firstPerson: n/a

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.