C++ | Class and Object | Question 6
Which of the following is true about the following program
Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C
course to start learning today.
"Enter the value of i: "
std::cin >> i;
"value of i in local t: "
"value of i in global t: "
Contributed by Pravasi Meet
(A) Compiler Error: Cannot have two objects with same class name
(B) Compiler Error in Line “::t.get();”
(C) Compiles and runs fine
Explanation: The above program compiles & runs fine. Like variables it is possible to create 2 objects having same name & in different scope.
Quiz of this Question