C++ Advanced Tutorial - Lesson 11
Related Blog Items
- C++ Tutorial Part 2 - Advanced
- C++ Basics - Tutorial
- C++ Advanced Tutorial - Lesson 8
- C++ Advanced Tutorial - Lesson 3
- C++ Advanced Tutorial - Lesson 2
Please refer Lesson 10..
11. SOME INDIVIDUAL TOPICS
11.1 DOS Keyboard Characteristics
11.2 Detach Method for Wrapper Classes
11. SOME INDIVIDUAL TOPICS
11.1 DOS Keyboard Characteristics
When any key on the keyboard is pressed, a parameter in the operating system is set, and this parameter can be checked through method kbhit( ) in Some wrapper classes has a pointer to another dynamic object. In its destructor it usually delete that object to free the space. However, if some one calls its “get” method which returns this pointer to the outside world, then the dynamic object is taken care of by another program and should be “detached” from the wrapper class, so that the destructor is no longer responsible to delete that dynamic object.:
11.2 Detach Method for Wrapper Classes
class Person { private: char * m_strName; public: Person(char * name = NULL) : m_strName(name) {} ~Person() { if(m_strName != 0) delete m_strName; } char * Detach() { char * temp; temp = m_strName; m_strName = 0; return temp; } }
Popularity: 40%
You need to log on to convert this article into PDF
Related Blog Items - C++ Tutorial Part 2 - Advanced
- C++ Basics - Tutorial
- C++ Advanced Tutorial - Lesson 8
- C++ Advanced Tutorial - Lesson 3
- C++ Advanced Tutorial - Lesson 2
Related Blog Items
- C++ Tutorial Part 2 - Advanced
- C++ Basics - Tutorial
- C++ Advanced Tutorial - Lesson 8
- C++ Advanced Tutorial - Lesson 3
- C++ Advanced Tutorial - Lesson 2
No Comments
No comments yet.