home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 215 / DDJ11A92.ZIP / CPPLIB.ASC < prev    next >
Text File  |  1992-10-29  |  1KB  |  72 lines

  1. _DEVELOPING A PORTABLE C++ GUI CLASS LIBRARY_
  2. by Andreas Meyer
  3.  
  4. Example 1: 
  5.  
  6. class MyDialog : public ModalDialog
  7. {
  8. protected:
  9.     DefPushButton   aOkButton;
  10. public:
  11.             MyDialog( Window* pParent );
  12.     void    QuitDialog( DefPushButton* pButton );
  13. }
  14.  
  15. MyDialog::MyDialog( Window* pParent ) :
  16.           ModalDialog( pParent ),
  17.           aOkButton( this )
  18. {
  19.     aOkButton.ChangeClickHdl( LINK( this, MyDialog::QuitDialog ) );
  20. }
  21.  
  22. void MyDialog::QuitDialog( DefPushButton* pButton )
  23. {
  24.     if( ... )   // check dialog state
  25.         ModalDialog::EndDialog();
  26. }
  27.  
  28.  
  29.  
  30. Example 2:
  31.  
  32.  
  33. (a)
  34.  
  35. class Object
  36. {
  37.     Object GetNext();
  38. }
  39. if( bTest && ( aObj.GetNext() == aObj ) ) ...
  40.  
  41. (b)
  42.  
  43. Obj aNext = aObj.GetNext();
  44. if( bTest && ( aNext == aObj ) ) ...
  45.  
  46.  
  47. Example 3:
  48.  
  49. (a) 
  50.  
  51. #define CONCAT( a, b )  a##b
  52. CONCAT( A, B )          // this will throw an error
  53.  
  54. (b) 
  55.  
  56. #define CONCAT( a, b ) a/**/b 
  57.  
  58.  
  59.  
  60. Example 4:
  61.  
  62. class Base
  63. {
  64.     ~Base() { foo(); }
  65.     virtual foo();
  66. }
  67. class Derived : public Base
  68. {
  69.     virtual foo();
  70. }
  71.  
  72.