What will be the output of the following C++ code? [code] #include <iostream> using namespace std; class number {

What will be the output of the following C++ code?
Code:
    #include <iostream>
    using namespace std;
    class number
    {
        int i;
        public:
        int geti();
        void puti(int j);
    };
    int number::geti()
    {
        return i;
    }
    void number::puti(int j)
    {
        i = j;
    }
    int main()
    {
        number s;
        s.puti(10);
        cout << s.geti( );
        return 0;
    }
A. 10
B. 11
C. 20
D. 22
 

Tìm kiếm

Back
Top