Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class printData {
  5.    public:
  6.       void print(int i) {
  7.          cout << "Printing int: " << i << endl;
  8.       }
  9.  
  10.       void print(double  f) {
  11.          cout << "Printing float: " << f << endl;
  12.       }
  13.  
  14.       void print(char* c) {
  15.          cout << "Printing character: " << c << endl;
  16.       }
  17. };
  18.  
  19. int main(void) {
  20.    printData pd;
  21.  
  22.    // Call print to print integer
  23.    pd.print(5);
  24.    
  25.    // Call print to print float
  26.    pd.print(500.263);
  27.    
  28.    // Call print to print character
  29.    pd.print("Hello C++");
  30.  
  31.    return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement