A(string s) { this?
What happens when you attempt to compile and run the following code?
#include <iostream>
#include <string>
using namespace std;
class A {
public:
string s;
A(string s) { this?>s = s; }
};
class B {
public:
string s;
B (A a) { this?>s = a.s; }
void print() { cout<<s; }
};
int main()
{
A a("Hello world");
B b=a;
b.print();
}
A . It prints: Hello world
B.It prints: Hello
C.Compilation error
D.None of these
Answer: A
Latest CPA-21-02 Dumps Valid Version with 222 Q&As
Latest And Valid Q&A | Instant Download | Once Fail, Full Refund
Subscribe
Login
0 Comments
Inline Feedbacks
View all comments