CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    6

    Lightbulb reference_type_parameter

    Hi,

    I have a question. If I have a class with a method that requires a parameter which is an instance of another class, how should I write the code for a method in that class which inputs the parameter.

    Here is some example code, to clarify my question:

    Here's the first class, which has the method which requires an object as a parameter

    public ClassA{
    //instance vars, constructor

    // method
    public void methodA(ClassB B){
    }
    }

    Here's the second class

    public ClassB{
    //instance vars, constructor

    // method
    public void methodB(){
    ClassA.methodA(this)
    }
    }

    Im interested in the bold part. Is it the correct parameter for the method?


    Thanks!

    Niels

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: reference_type_parameter

    Have you tried it? It seems simple enough to write a small program and test it.
    Norm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured