User Profile

Collapse

Profile Sidebar

Collapse
smoermeli
smoermeli
Last Activity: Feb 23 '08, 05:51 PM
Joined: Aug 2 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • smoermeli
    replied to Trouble accessing member class' function
    in C
    I'm not sure how that wrapper should work, my compiler says: `Thing' is not a base of `Person'

    But anyway, after a good night's sleep I figured out what was the mistake in my thinking. What I initially wanted to do was something like this:
    Suppose I want Person to have another type of data, also contained in a vector, for example std::vector<Oth erThing> otherthings, where OtherThing could be a subclass of Thing or some...
    See more | Go to post

    Leave a comment:


  • smoermeli
    replied to Trouble accessing member class' function
    in C
    Argh, of course. All the time I just kept thinking that if I declared the vector public, it would expose the data fields of the objects contained in it - but now that I read your suggestion and thought it over, of course it doesn't expose them. Now I feel stupid.

    Thanks. =)
    See more | Go to post

    Leave a comment:


  • smoermeli
    started a topic Trouble accessing member class' function
    in C

    Trouble accessing member class' function

    [CODE=cpp]
    #include <iostream>
    #include <vector>

    class Thing {
    private:
    int value;
    friend class Person;
    public:
    int getValue() { return value; }
    void setValue(const int val) { value=val; }
    Thing (const int val) { value=val; } // Constructor
    };

    class Person {
    private:
    ...
    See more | Go to post
No activity results to display
Show More
Working...