Which of the following is true about the following program#include <iostream> class Test{public:int i;void get() ;};void Test::get() {std::cout <<"Enter the value of i: "; std::cin >>i;}Test t; // Global object int main() {Test t; // local object t.get() ;std::cout <<"value of i in local t: "<<t.i<<'\n';::t.get() ;std::cout <<"value of i in global t: "<<::t.i<<'\n'; return 0;}
A) compiler error: cannot have two objects with same class name
B) compiler error in line "::t.get() ;"
C) compiles and runs fine
Correct Answer:
Verified
Q10: Which of the following interface determines how
Q11: What is the difference between struct and
Q12: Predict the output of following C++ program#include<iostream>
Q13: class Test { int x;};int main(){Test t;
Q14: Which of the following is true?
A)all objects
Q16: Which of the following is true about
Q17: Predict the output?#include <iostream> using namespace std;class
Q18: What happens when delete is used for
Q19: Is it fine to call delete twice
Q20: Which of the followings is/are automatically added
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents