Search:

Type: Posts; User: comocomocomo

Search: Search took 0.00 seconds.

  1. Replies
    23
    Views
    2,227

    I'm reading Scott Meyers' "Effective C++, 3rd...

    I'm reading Scott Meyers' "Effective C++, 3rd edition". I'm still with item 19, but I followed some cross references and ended up in item 46: "Define non-member functions inside templates when type...
  2. Replies
    23
    Views
    2,227

    You are right. I included inheritance in an...

    You are right. I included inheritance in an attempt to address the most general case.

    When using inheritance, you just need to write the operator<< once. I find this fact very interesting. That's...
  3. Replies
    23
    Views
    2,227

    Oh, and you might want B's print() to show the...

    Oh, and you might want B's print() to show the inherited part of the object by calling A's print():



    class B : public A
    {
    public:

    virtual void print (std::ostream & os) const
    ...
  4. Replies
    23
    Views
    2,227

    I think it's the other way around. If everything...

    I think it's the other way around. If everything is passed by reference, my design requires no copy operations. If you put the text in a std::string and then pass it to the op<< for strings, you...
  5. Replies
    23
    Views
    2,227

    In these cases I prefer to implement the...

    In these cases I prefer to implement the functionality in a public method (virtual, most of the times). The operator << receives a reference to the object and calls the virtual method.
  6. Replies
    23
    Views
    2,227

    Very interesting! Well, that narrows my list of...

    Very interesting! Well, that narrows my list of real-life, good 'friend' examples (from my own experience) to... zero ;-)
  7. Replies
    23
    Views
    2,227

    Suppose that you have to write your own STL-like...

    Suppose that you have to write your own STL-like container. The iterators might need to access the internals of the data structure. When you implement the ++ operator, for instance, you have two...
Results 1 to 7 of 7