Are based upon the following class declaration appearing in
Are based upon the following class declaration appearing in unknown.h All member function will be defined in the unknown.cpp class unknown {private: int a; public: unknown ();//Initializes a to 0 void seta (const int aa);//set a equal to aa void GetA(int & aa) const;//sends value of a to client through aa}; Which of the following is a valid implementation for setA? Void seta(int aa) const void unknown:: setA(aa) const void unknown::SetA() {aa=a;} {aa=a;} {a=aa;} void unknown::SetA(const int aa){a=aa;} none of the answer provided {a=aa;} Which of the following is a valid is a valid function heading for the function for the function unknown? Void unknown(); void unknown::unknown() unknown() int unknown::unknown() none of the answers provided Which of the following is a valid function heading for the function GetA? Int unknown::GetA(int& aa) void getA(int& aa) void unknown::GetA(int& aa)const None of the answers provided Suppose that a client program
Solution
12) (B) void Unknown:: Set (int aa) const{
aa = a;
}
13)(B) void Unknown:: Unknown()
14) (D) int Unknown:: GetA (int &aa) const
15) (D) cout<<X.GetA() <<endl;
16) (A) X.SetA(7)
Thanks, let me know if there is any concern.
Note : In the class it should be
int GetA(int &aa) const ; // Ask Your instructor to change void to int.
Let me know if there is any concern.
