1

I read that this form of getline:

getline(char *buf, streamsize num)

But I recently came across this getline function:

getline(cin,x);

where x is a string.

How is this ?

Kiril Kirov
  • 36,509
  • 22
  • 109
  • 183
program-o-steve
  • 2,531
  • 13
  • 44
  • 66
  • 2
    [Function overloading](http://www.codersource.net/c/c-tutorials/c-tutorial-function-overloading.aspx)? – Uwe Keim Jun 30 '11 at 09:38

2 Answers2

0

The first one is a member function of std::istream. And the second one is a free standalone function. You've overloaded functions for both.

Nawaz
  • 341,464
  • 111
  • 648
  • 831
0

The former is a member function of basic_istream.

The later is a free function.

Didier Trosset
  • 34,718
  • 13
  • 85
  • 119
  • 1
    @steve: A free function is a function that is not a member-function. If you do not know that, you should read a [book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list). – Björn Pollex Jun 30 '11 at 09:43