Câu 1: CPP: C++ Certified Professional Programmer
Which method added to class B at the marked spot will allow the code below to compile? Choose all possible solutions.#include #include #include using namespace std;class B { int val;public:B(int v):val(v){}int getV() const {return val;}/* Insert Code Here */};ostream & operator struct Out { ostream & out;Out(ostream &…
Nội dung câu hỏi
Which method added to class B at the marked spot will allow the code below to compile? Choose all possible solutions.#include #include #include using namespace std;class B { int val;public:B(int v):val(v){}int getV() const {return val;}/* Insert Code Here */};ostream & operator struct Out { ostream & out;Out(ostream & o): out(o){}void operator() (const T & val ) { out v1(t, t+10); sort(v1.begin(), v1.end(), greater ()); for_each(v1.begin(), v1.end(), Out (cout));cout<<endl; return 0;}
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- A. bool operator < (const B & v) const { return val<v.val;}
- B. bool operator > (const B & v) const { return val<v.val;} — đáp án hiện tại
- C. bool operator > (const B & v) const { return val>v.val;} — đáp án hiện tại
- D. bool operator == (const B & v) const { return val==v.val;} — đáp án hiện tại
- E. operator int () const { return val; }
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.