1831
GB
What is the output: class Transform{public:virtual int apply(int x)const=0; virtual ~Transform()=default;}; class Scale:public Transform{int f;public:Scale(int v):f(v){} int apply(int x)const override{return x*f;}}; class Shift:public Transform{int s;public:Shift(int v):s(v){} int apply(int x)const override{return x+s;}}; vectorts={new Scale(2),new Shift(3)}; int v=5; for(auto t:ts)v=t->apply(v); cout<
IN
आउटपुट क्या है: class Transform{public:virtual int apply(int x)const=0; आभासी ~परिवर्तन()=डिफ़ॉल्ट;}; वर्ग स्केल:सार्वजनिक ट्रांसफ़ॉर्म{int f;सार्वजनिक:स्केल(int v):f(v){} int apply(int x)const ओवरराइड{रिटर्न x*f;}}; क्लास शिफ्ट:पब्लिक ट्रांसफॉर्म{int s;public:Shift(int v):s(v){} int apply(int x)const ओवरराइड{रिटर्न x+s;}}; वेक्टरट्स={नया स्केल(2),नया शिफ्ट(3)}; int v=5; for(auto t:ts)v=t->apply(v); अदालत
A
13
13
B
10
10
C
Compile error
संकलन त्रुटि
D
Undefined
अपरिभाषित
✅ Correct Answer:
💡 Explanation / व्याख्या
Explanation (English)
5*2=10; 10+3=13. Output: 13.
व्याख्या (हिन्दी)
5*2=10; 10+3=13. आउटपुट: 13.