In Example 20.10, identify the scope/storage class of each object's creation/definition. If there is a name clash, describe the error.
[ fromfile: scopestorage.xml id: ex-scopestorage ]
Example 20.10. src/storage/storage.cpp
#include <QString> int i; static int j; extern int k; const int l=10; extern const int m=20; class Point { public: QString name; QString toString() const; private: static int count; int x, y; }; int Point::count = 0; QString Point::toString() const { return QString("(%1,%2)").arg(x).arg(y); /* Scope: ______________ Storage class: ____________ */ } int main(int argc, char** argv) { int j; register int d; int* ip = 0; ip = new int(4); Point p; Point* p2 = new Point(); }
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
S/SC of argc and argv: _________________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
|
Scope: ______________ Storage class: ____________ |
Generated: 2012-03-02 | © 2012 Alan Ezust and Paul Ezust. |