Essay
Which of the following are legal access to the class or struct members? Assume each is outside of the class member definitions,
struct S class C class D
{ { {
int x;int x;public:
int y;int y;int x;
} private: int y;
S s;int z;private:
};int z;
C c;};
D d;
a)s.x
b)c.x
c)d.x
d)c.z
e)d.z
Correct Answer:

Verified
a)s.x is legal.struct members are public...View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Correct Answer:
Verified
View Answer
Unlock this answer now
Get Access to more Verified Answers free of charge
Q4: It is valid to initialize member variables
Q5: Assignment behaves essentially the same for vectors
Q6: Why is it an error to add
Q7: A class member that is to be
Q8: A class may not have another class
Q10: Explain why data members,in particular should be
Q11: A constructor is like a function.It can
Q12: You can write a class that is
Q13: Any use of the keyword const is
Q14: It is legal to call a constructor