Quiz: Object-Oriented Programming
Test your understanding with a few technical questions.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
Consider the following code snippet. Which line causes a compilation error?
class Box {
int width;
public:
void setWidth(int w) { width = w; }
};
int main() {
Box b;
b.setWidth(10); // Line A
b.width = 5; // Line B
}
A.
Line A
B.
Line B
C.
Both Line A and B
D.
Neither Line A or B
1 / 10
...