c++沉思录 代码集 1

c++沉思录 代码集 1
/*
  Name: Why C++ ?(basic funtion)
  Copyright: 
  Author: elprup
  Date: 08/10/10 09:18
  Description: 
*/
#include 
< cstdio >
#include 
< cstdlib >

#include 
< iostream >
using   namespace  std;

int  print( const   char *  s)
{
    printf(
" %s\n " , s);
    
return   0 ;    
}

class  trace_cpp
{
public :
    
int  print( const   char * s){printf( " %s\n " , s);  return   0 ;}
};

int  main()
{
    
// c style trace
    print( " Hello from c. " );
    
    
// cpp style trace;
    trace_cpp tc;
    tc.print(
" Hello from c++ " );
    
    system(
" PAUSE " );
    
return   0 ;
}

你可能感兴趣的:(c++沉思录 代码集 1)