Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7800369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:36:47+00:00 2026-06-02T00:36:47+00:00

To the down-voters: I understand that this was a poorly constructed question. If you’ll

  • 0

To the down-voters: I understand that this was a poorly constructed question. If you’ll scroll down to the answers, you’ll see that I discovered the source of the problem. While the question itself might not be helpful, I hope the answer will help somebody experiencing similar trouble with operator overloading. The problem was what it was; I cannot identify any edits or revisions that would make this a better question. Therefore, if you’re going to submit a down-vote, please add a constructive comment as well. Thank you.


I’m running the following code

myObject o = myObject();
cout << o << endl;

My (friend) << operator is overloaded here:

ostream& operator << (ostream& s, myObject o)
{
    s << doStuff(o, s) << endl;
    return s;
}

Expected output:

object contents

Actual output is, for some reason, including the memory address:

5452ED48object contents

Why?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:36:50+00:00Added an answer on June 2, 2026 at 12:36 am

    Sorry for not providing enough detail. It turned out that I should have done this:

    doStuff(o, s);
    return s;
    

    Apparently I was appending the desired output to s, which already contained the address.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is more logic than programming at the moment.. once I understand what
Well, how to create picture link like this up or down votes (on the
I have a drop down menu which you can see here on jsfiddle .
Okay I am probably going to get a load of down votes for this
Reading this SO question , I started wondering - what is the correct way
This is marked as a subjective question, I hope I won't get too many
Possible Duplicate: What does ||= mean? In this previous question, I asked about an
Before someone down votes me for asking yet another centering problem. Please read my
I hope my question will be clear and perfect enough to not get down
This is kind of a broad question but I wanted to ask anyways. Hopefully

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.