DOCUMENT:Q189772 11-DEC-1999 [foxpro] TITLE :FIX: GETPEM() Function Does Not Return the Correct ParentClass PRODUCT :Microsoft FoxPro PROD/VER:WINDOWS:5.0,5.0a OPER/SYS: KEYWORDS: ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a ------------------------------------------------------------------------------- SYMPTOMS ======== If you use the GETPEM() function to return the value of the ParentClass property of an instantiated class, you might get incorrect results. The return value might be the ParentClass from another class in the class hierarchy, or might be empty when it should have a value. STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This has been corrected in Visual FoxPro 6.0. MORE INFORMATION ================ You use the GETPEM() function to return values of properties, or code from events/methods of any classes or objects in memory. The GETPEM() function requires two parameters. First, you pass it an object reference or the name of a class. Second, you pass it a property, event, or method name. Steps to Reproduce Behavior --------------------------- 1. Run the following code from a program (.prg) file: CLEAR CLEAR ALL oMe = CREATEOBJECT( "Son" ) cClass = oMe.CLASS DO WHILE NOT(EMPTY(cClass)) ?cClass + ' was begotten by ' + GETPEM(cClass, "ParentClass") cClass = GETPEM(cClass, "ParentClass") ENDDO DEFINE CLASS granddad AS CUSTOM ENDDEFINE DEFINE CLASS Dad AS granddad ENDDEFINE DEFINE CLASS Son AS Dad ENDDEFINE RESULT: If you run the code under Visual FoxPro 5.0x, the program returns the following to the desktop: Son was begotten by Granddad Granddad was begotten by This is incorrect. The correct return values are: Son was begotten by Dad Dad was begotten by Granddad Granddad was begotten by Custom Custom was begotten by Additional query words: kbVFp500abug kbVFp600fix kbOOP ====================================================================== Keywords : Technology : kbVFPsearch kbAudDeveloper kbVFP500 kbVFP500a Version : WINDOWS:5.0,5.0a Issue type : kbbug Solution Type : kbfix ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1999.