题海让大学四年没有难题
白天模式登陆

题目详情

单选题 The result of running the following program is ( ).#include <iostream>using namespace std;template <class T>class Num {private: T x;public: Num( ) { } Num(T x) { this->x = x; } Num<T>& operator + (const Num<T>& x2) { static Num<T> temp; temp.x = x + x2.x; return temp; } void disp( ) { cout << "x = " << x; }};int main ( ) { Num<int> A(3.8), B(4.8); A = A + B; A.disp( ); return 0;}

A. x = 7

B. x = 8

C. x = 3

D. x = 4

C++语言程序设计课程封面

学科:C++语言程序设计

时间:2025-12-18 02:35:52

Copyright © 2022 津ICP备2021001502号