Question 1: Given the declaration: class myClass { public: void print(); int y;
ID: 3557695 • Letter: Q
Question
Question 1: Given the declaration:
class myClass {
public:
void print();
int y;
private:
int x;
};
myClass myObject;
which statement is legal?
myObject.x = 10;
myClass.x = 10;
myObject.y = 10;
myClass.y = 10;
(i)
class student
{
public:
void student();
void student(string s, double g, int i);
void set(string s, double g, int i);
void print();
private:
string name;
double gpa;
int id;
};
(ii)
class student
{
public:
student();
student(string s, double g, int i);
void set(string s, double g, int i);
void print();
private:
string name;
double gpa;
int id;
}; Only (i)
Only (ii)
Both (i) and (ii)
None of these
Explanation / Answer
1)iii
2)ii
3)iii
4)i
5)iii
6)iii
7)iii
8)iii
9)iii
10)i
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.