Closed Thread
Results 1 to 3 of 3

Thread: Simple Q on Public and Private types

  1. #1
    Namesake is offline Newbie
    Join Date
    Feb 2010
    Posts
    21
    Rep Power
    0

    Red face Simple Q on Public and Private types

    Hey all,
    Simple question here:

    During the construction of my code I came across a simple question; are the variable that are instantized within member functions of a class private to that function only, or are they seen by all members.

    Suppose I use create an int 'i' in a for loop for the member function 'dothis();'; will that same int be recognised by another member function, or can I reuse the name 'i' else where in the class?

    Note that int i was not defined in the header file for the class, it is just a throw away variable...


  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    bobdark's Avatar
    bobdark is offline Programmer
    Join Date
    Jan 2010
    Location
    Haifa, Israel
    Posts
    164
    Rep Power
    9

    Re: Simple Q on Public and Private types

    If I understood you right, you are asking whether a variable that is declared in some function, is seen and recognized by other functions. If thats the question, the answer is no - it is a local variable - it means its only seen in the scope which it is defined in.

  4. #3
    Namesake is offline Newbie
    Join Date
    Feb 2010
    Posts
    21
    Rep Power
    0

    Re: Simple Q on Public and Private types

    Thanks!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How are algorithms that can produce public/private key pairs made
    By liamzebedee in forum Software Security
    Replies: 2
    Last Post: 06-05-2011, 12:52 PM
  2. Replies: 2
    Last Post: 07-16-2010, 04:50 AM
  3. Passing string from one private sub to another private sub
    By terrylau in forum Visual Basic Programming
    Replies: 1
    Last Post: 07-10-2009, 05:24 AM
  4. SSH: Linux Generate Public/Private Key Login
    By Tor in forum Linux Tutorials, Guides and Tips
    Replies: 3
    Last Post: 12-24-2008, 09:16 AM

Tags for this Thread

Bookmarks

Posting Permissions

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