Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. how to do function like cout

how to do function like cout

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KARFER
    wrote on last edited by
    #1

    Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's

    -*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*

    L _ S 3 Replies Last reply
    0
    • K KARFER

      Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's

      -*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      See here[^] for information on deriving your own stream classes in C++.

      I must get a clever new signature for 2011.

      1 Reply Last reply
      0
      • K KARFER

        Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's

        -*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        cout is not a function. cout is an object of a class called basic_ostream. This class has overloaded the operator << to accept many different data types as parameters like string, char*, short, long etc.

        «_Superman_»  _I love work. It gives me something to do between weekends.

        _Microsoft MVP (Visual C++)

        Polymorphism in C

        1 Reply Last reply
        0
        • K KARFER

          Hi all how to do function like cout<<"" but without using cout and with different name. I want to say how to create a print function without using cout and name it as you like. I hear that i can do it by overloading or overriding or anything else .. i don't know. Thank's

          -*-*-*-*-*-*-*-*-* To Be Or Not To Be (KARFER) -*-*-*-*-*-*-*-*-*

          S Offline
          S Offline
          Stefan_Lang
          wrote on last edited by
          #4

          As correctly pointed out, the problem at hand is deriving your own stream class. Just entering that into a search on CP (using the tag "C++") gave me a list of articles, the third of which looked promising: audio_ostream - A Text-to-Speech ostream. If nothing else it's a working example with code.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups