C++ 解法, 执行用时: 2ms, 内存消耗: 272KB, 提交时间: 2021-11-13
#include <iostream> using namespace std; class Person { // write your code here...... friend void showAge(Person & p); public: Person(int age) { this->age = age; } private: int age; }; void showAge(Person& p) { cout << p.age << endl; } int main() { Person p(10); showAge(p); return 0; }
C++ 解法, 执行用时: 2ms, 内存消耗: 276KB, 提交时间: 2022-05-30
#include <iostream> using namespace std; class Person { // write your code here...... friend void showAge(Person& p); public: Person(int age) { this->age = age; } private: int age; }; void showAge(Person& p) { cout << p.age << endl; } int main() { Person p(10); showAge(p); return 0; }
C++ 解法, 执行用时: 2ms, 内存消耗: 280KB, 提交时间: 2022-01-22
#include <iostream> using namespace std; class Person { // write your code here...... friend void showAge(Person);// public: Person(int age) { this->age = age; } private: int age; }; void showAge(Person p) { cout << p.age << endl; } int main() { Person p(10); showAge(p); return 0; }
C++ 解法, 执行用时: 2ms, 内存消耗: 280KB, 提交时间: 2022-01-04
#include <iostream> using namespace std; class Person { // write your code here...... friend void showAge(Person &); //这样啊 public: Person(int age) { this->age = age; } private: int age; }; void showAge(Person& p) { cout << p.age << endl; } int main() { Person p(10); showAge(p); return 0; }
C++ 解法, 执行用时: 2ms, 内存消耗: 280KB, 提交时间: 2021-11-10
#include <iostream> using namespace std; class Person { // write your code here...... friend void showAge(Person &); public: Person(int age) { this->age = age; } private: int age; }; void showAge(Person& p) { cout << p.age << endl; } int main() { Person p(10); showAge(p); return 0; }