Thread: Nested classes question...

  1. #1
    Registered User
    Join Date
    Sep 2004

    Exclamation Nested classes question...

    hi guys...

    i have a class called Astar and a Node class within it...i have a method readfile() outside the Astar class...I want to now declare a vector of Nodes within readfile() but I get an error: E2451: Undefined symbol Node...i write:

    vector <Node *> VectorOfNodes

    what's the problem?

    Best Regards,


    Here is the structure of the code:

    I am giving the strcutre below...I've removed most of the things so it's easier to understand. The error is in the line: vector <Node *> CityNode; in the method: readfile()

    class Astar

    class Node

    int x;
    int y;




    void readFile()
    vector <Node *> CityNode;

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    >vector <Node *> CityNode;
    You need to tell the compiler that Node is nested in Astar:
    vector <Astar::Node *> CityNode;
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Sep 2004
    works!!! thanks a lot...was confused about this for 2 forum ever!
    Last edited by alvifarooq; 09-18-2004 at 05:03 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-28-2006, 02:59 PM
  2. Question With Nested If's
    By jarvis in forum C Programming
    Replies: 7
    Last Post: 07-26-2006, 08:06 AM
  3. Simple Question about Classes
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-26-2006, 02:40 AM
  4. A little question about classes
    By Newbeee in forum C++ Programming
    Replies: 9
    Last Post: 06-15-2006, 03:46 PM
  5. Newbie question about the Private type in classes
    By Ryeguy457 in forum C++ Programming
    Replies: 1
    Last Post: 09-07-2002, 10:17 PM