C++ const string reference parameter

Description

C++ const string reference parameter

#include <string>
#include <iostream>
using std::string;

void print(const string& s){
  std::cout << s << std::endl;
}

void print_that(const string& s) {
  print(s);//from  www.  j a v  a 2s  .c  o  m
}
void print_this(const string& s){
  print(s);
}

int main()
{
  print_this("This is a test string using print_this().");
  print_that("This is a test string using print_that().");
}



PreviousNext

Related