scoperes.cpp

来自「Thinking_in_C___2.rar」· C++ 代码 · 共 30 行

CPP
30
字号
//: C03:Scoperes.cpp
// From Thinking in C++, 2nd Edition
// at http://www.BruceEckel.com
// (c) Bruce Eckel 1999
// Copyright notice in Copyright.txt
// Defining a non-inline member function
#include <iostream>
using namespace std;

class Example {
  int i, j, k;
 public:
  Example(); // Declare the function
  void print(); // Ditto
};
Example::Example() { // The constructor
  i = 12;
  j = 100;
  k = 47;
}
void Example::print() {
  cout << "i = " << i;
  cout << ", j = " << j;
  cout << ", k = " << k << endl;
}
int main() {
  Example test;
  test.print();
} ///:~

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?