Return class(a) pointer in another class(b) function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phoenix1990
    New Member
    • May 2009
    • 18

    Return class(a) pointer in another class(b) function

    So i've been working on a program in c++ that uses classes, and i am having a few problems with returning a class value from another class's function.

    So i have a class called X, which is essentially a class that defines a linked list, and has some of the basic operations. In that class i have a '[]' operator that is overloaded with each value in the linked list. The operator can also override values in the linked list using
    Code:
    *classxvariable[i] = "string";
    the function for that is
    Code:
    std::string* X::operator[](long index)
    I also have another class called Y which calls upon class X for it's operator function
    Code:
    X* Y::operator[](long index)
    Class Y is also a linked list

    the problem is for
    Code:
    X* Y::operator[](long index){}
    i'm not sure how to go about getting the function to return X*
    from the class Y

    Thanks,
    Phoenix1990
    Last edited by Nepomuk; Sep 12 '10, 08:23 AM. Reason: Please use [CODE] tags
  • phoenix1990
    New Member
    • May 2009
    • 18

    #2
    Never mind i figured it out.

    Comment

    Working...