






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Unix Programming; Subject: Computer Science; University: Emporia State University; Term: Fall 2004;
Typology: Study notes
1 / 10
This page cannot be seen from the preview
Don't miss anything!
class Surround { public: class FirstWithin { int d_variable;
public: FirstWithin(); int var() const {
return (d_variable); } }; private: class SecondWithin { int d_variable;
public: SecondWithin(); int var() const { return (d_variable); } }; };
FirstWithin::epoch
16.2: Declaring nested classes
class Outer { private: class Inner2; // forward declaration
class Inner { Inner2 *pi2; // points to Inner2 objects }; class Inner { Inner1 *pi1; // points to Inner1 objects }; };
16.3: Accessing private members in nested classes
class Surround { static int s_variable; public: class FirstWithin { static int s_variable;
public: int value(); };
int value(); private: class SecondWithin { static int s_variable;
public: int value(); }; };
class Surround { static int s_variable;
public: class FirstWithin { friend class Surround;
static int s_variable;
public: int value(); }; int value() { FirstWithin::s_variable = SecondWithin::s_variable; return (s_variable); } private: class SecondWithin { friend class Surround;
static int s_variable;
public: int value(); }; };
class Surround { class FirstWithin;
Surround' does not have a nested type named
SecondWithin'
class Surround { class SecondWithin;
static int s_variable;
public: class FirstWithin { friend class Surround; friend class SecondWithin;
static int s_variable;
public: int value() { Surround::s_variable = SecondWithin::s_variable; return (s_variable); } }; friend class FirstWithin;
int value() { FirstWithin::s_variable = SecondWithin::s_variable; return (s_variable); } private: class SecondWithin { friend class Surround; friend class FirstWithin;
static int s_variable;
public: int value() {
Surround::s_variable = FirstWithin::s_variable; return (s_variable); } }; friend class SecondWithin; };
16.4: Nesting enumerations
class ios : public _ios_fields { public: enum seek_dir { beg, cur, end }; };
class DataStructure { public: enum Traversal { forward, backward }; setTraversal(Traversal mode); private: Traversal d_mode; };
void DataStructure::setTraversal(Traversal mode) { d_mode = mode; switch (d_mode) { forward: break;
enum EmptyEnum {};
int main() { try { throw EmptyEnum(); } catch (EmptyEnum) { cout << "Caught empty enum\n"; } } /* Generated output: Caught empty enum */