home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / samples / compiler / dts / hhmain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-20  |  1.2 KB  |  48 lines

  1.  
  2. #include <stdio.h>
  3.  
  4. #include "info.hh"
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. //
  9. // Create an object of class Info.
  10. //
  11.  
  12.     Info * anInfo = new Info;
  13.  
  14. //
  15. // Since we are using the DTS compiler, and pragma SOMNoDataDirect is
  16. // not in effect and the instance data of class info are attributes,
  17. // we can access public instance data of class Info  directly or indirectly
  18. // via explicit calls to an instance data's get or set method.
  19. // Also, as a point of interest, the second argument passed during a method
  20. // call is a ptr to an Environment struct. This argument is passed implicitly
  21. // because of VA for C++'s DTS support but must be passed explicitly when
  22. // using the 'XH' C++ bindings.
  23. //
  24.  
  25.  
  26.     printf("Local anInfo->x        = %d\n", anInfo->x);
  27.  
  28.     printf("Local anInfo->_get_x() = %d\n", anInfo->_get_x());
  29.  
  30.     printf("Local anInfo->y        = %c\n", anInfo->y);
  31.  
  32.     anInfo->_set_y('B');
  33.  
  34.     printf("Local anInfo->_get_y() = %c\n", anInfo->_get_y());
  35.  
  36. //
  37. // Since anInfo is a SOM object, it inherits methods from it's parent
  38. // class SOMObject. One of these methods is somDumpSelf.
  39. // Method somDumpSelf outputs the internal state of an object.
  40. //
  41.  
  42.     anInfo->somDumpSelf(0);
  43.  
  44.     return(0);
  45. }
  46.  
  47.  
  48.