CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
+ Reply to Thread
Results 1 to 4 of 4
  1. #1

    Why copy constructor of ostream class is private?

    Why copy constructor of ostream class is private?

  2. #2
    Lindley is offline Elite Member Power Poster Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+) Lindley has much to be proud of (1500+)
    Join Date
    Oct 2007
    Location
    Fairfax, VA
    Posts
    10,861

    Re: Why copy constructor of ostream class is private?

    Because it wouldn't make much sense to copy an ostream. Let's say you do. Now, how are writes to the two copies of the stream supposed to resolve themselves? They'd be constantly overwriting each other.

  3. #3

    Re: Why copy constructor of ostream class is private?

    Can someone more light on this?

  4. #4
    Join Date
    Mar 2002
    Location
    Kent, United Kingdom
    Posts
    399

    Re: Why copy constructor of ostream class is private?

    It is made private so you can't copy it.

    As Lindley said, there is no sense in having two ostreams.
    What use would there be in having two items doing the same job ?
    How would they sort out which is supposed to be doing the work at any particular time ?
    your humble savant

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts



HTML5 Development Center

Click Here to Expand Forum to Full Width