cuốn sách gpt4 ai đã làm

c++ - con trỏ này, toán tử= và toán tử++

In lại Tác giả: Walker 123 更新时间:2023-11-28 03:19:36 25 4
mua khóa gpt4 Nike

基于 operator= 复制重载和学习对象的赋值。为一个类编写 operator++。

指令是:

Seti operator++( );
This operator simply increases the value of a Seti object's frequency
by 1 (to a maximum of 9), before returning a copy of itself.
NOTE: The frequency can never exceed 9.

我可以这样做吗:

Seti Seti::operator++( ) {
Seti temp;
temp = *this
if (temp.freq<9)
temp.freq+=1;
return temp;
}

Cảm ơn.

25 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress