c++ - invalid use of non-static member C++98 -


i'm writing c++ program that, unfortunately, requires use of c++98 compiler. after writing program , trying compile error:

error: invalid use of non-static data member 'graph::adj_list'

this confusing me since used cppreference (http://en.cppreference.com/w/cpp/language/data_members) make sure compile. can me out?

graph_frame.h

#include <cstddef>   class node{ friend class graph; private:     int node_name;     int edge_weight;     node *next_cell = null;     node *previous_cell = null;  public:     node(int name = 0, int new_edge = 0);     ~node(); };   class graph{ private:     void recursive_delete(int i, int k);     node** adj_list;                     <----------------error  public:     //----argument not needed constructor because list not created     //----until create_graph() called     graph();     ~graph();     //----remember free buckets list     void create_graph(int& graph_nodes);     int check_node(int& source_node, int& dest_node);     void insert_node(int& source_node, int& dest_node, int& weight);     void print(node **dummy = adj_list, int = 0, int k = 0);     void delete_node(int& source_node, int& dest_node); }; 

node *next_cell = null; node *previous_cell = null; 

that won't fly - in-class initializers non-static members introduced in c++11.

about adj_list, real location of error here:

void print(node **dummy = adj_list, int = 0, int k = 0); //                      ^^^^^^^^^^ 

you can't have class member default value because it's not known instance should belong. can't use this there either, you'll have figure out other way pass default value.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -