Thread: Acessing a method

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    39

    Acessing a method

    Hello

    I wanna know if is possible to change a value of a method using another function.


    Example

    Code:
    int myclass::somefunc()
    {
    int x =10;
    return x;
    }
    Can I change the x to another value using a new method?

    If yes, how can i do it?

    Thanks

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    x is a local variable to that function. It does not exist in any other function, therefore its value cannot be changed in any other function.

    If you give us an overview of what you are trying to accomplish, maybe we can help you with another way of doing it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. on method pointers and inheritance
    By BrownB in forum C++ Programming
    Replies: 2
    Last Post: 03-02-2009, 07:50 PM
  2. Best communication method to thousand childs?
    By Ironic in forum C Programming
    Replies: 8
    Last Post: 11-08-2008, 12:30 AM
  3. C# method
    By siten0308 in forum C# Programming
    Replies: 6
    Last Post: 07-15-2008, 07:01 AM
  4. Overriding a method in C
    By DavidDobson in forum C Programming
    Replies: 1
    Last Post: 07-05-2008, 07:51 AM
  5. Replies: 2
    Last Post: 01-22-2008, 04:22 PM