Q39
What is the correct syntax to define a class named 'Rectangle' with private member variables 'length' and 'width' in C++?
A.
class Rectangle { private: int length; private: int width; };
B.
class Rectangle { int length, width; private: };
C.
class Rectangle { length, width; private: int; };
D.
class Rectangle { private: int length, width; };
AnswerAnswer: Option D
Solution
Answer: Option D
No explanation is given for this question Let's Discuss on Board