Home / MCQ Bank / Computer
Computer Plus Plus Miscellaneous

What will be the output of the following C++ code? #include <iostream> using namespace std; class Testpm { public: void m_func1() { cout << "func1\n"; } int m_num; }; void (Testpm :: *pmfn)() = &Testpm :: m_func1; int Testpm :: *pmd = &Testpm :: m_num; int main() { Testpm ATestpm; Testpm *pTestpm = new Testpm; (ATestpm.*pmfn)(); (pTestpm ->* pmfn)(); ATestpm.*pmd = 1; pTestpm ->* pmd = 2; cout << ATestpm.*pmd << endl << pTestpm ->* pmd << endl; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option D • func1 func1 1 2

Related Computer Questions

What will be the output of the following C code? #include <stdio.h> void main() { int k = 8; int x = 0 == 1 && k++; printf("%d%d\n", x, k); } MapReduce jobs submitted from either Oozie, Pig or Hive can be used to encode, improve and sample the data sets from ______ into R. Which one of the following can be used to instantiate an object in PHP assuming class name to be Foo? In C#, which class represents a writer that provides a fast, non-cached, forward-only way of generating sequences of characters from streams of bytes? In C, what are the basic loops required to perform an insertion sort?