none
Parameter Passing Garbage RRS feed

  • Question

  • Hello.

    I am curious how the code below is handled.  What happens to

    (SomeComInterface)(myComClass.ActiveDocument)

    as it is being passed to HelperClass contstructor?  Is there a temporary copy made?  How does this affect passing COM objects around ? 

    Once inside the constructor is the SpecificDocument variable the same object as the one passed in the function call ?

     

    Thanks for clarifying this.

    class
     Main()
    
    {
     public myComClass ComApp;
    
     void Main()
    
     {
    
     myComClass = CreateObject(...);
    
     HelperClass myHelper = new
     HelperClass((SomeComInterface)(myComClass.ActiveDocument));
    
     }
    
    }
    
    class HelperClass
    
    {
     private SomeComInterface WorkingDocument;
    
     public HelperClass(SomeComInterface SpecificDocument)
    
     {
    
     WorkingDocument = SpecificDocument;
    
     }
    
    
    }

    Monday, May 10, 2010 4:38 PM

Answers