计算机 选择题 简单 ★ 精品

友元函数与运算符重载 — 计算机选择题

C++ 程序设计(大学通用) 运算符重载 AI 三重审校通过

题目
在 C++ 中,若要将加法运算符重载为类 Complex 的友元函数,使其支持 c1 + c2(c1、c2 均为 Complex 对象),下列函数声明正确的是 A. friend Complex operator+(Complex &a, Complex &b); B. Complex operator+(Complex &a); C. Complex operator+(Complex a, Complex b); D. friend Complex add(Complex &a, Complex &b);