Create const string reference parameter - C++ Data Type

C++ examples for Data Type:const

Description

Create const string reference parameter

Demo Code

#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);/*  ww w. ja  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().");
}

Result


Related Tutorials