![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Unknown
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1
![]() |
Does python have private variables in classes?
Ive been studying python for 3 days right now and upon finishing the section about classes, Ive noticed that they don't have support for private variables, but they provide support for private methods, why is that? am i right? like this
python Syntax (Toggle Plain Text)
you can access some of the variables like this: python Syntax (Toggle Plain Text)
Ive programmed in c++, and im not a guru, but im a bit puzzled cause how can python support data hiding? what's the main difference of a c++ class in regards to python class with respect to data hiding? perhaps i haven't read the other part of the book that would clear this up but can you help me please... Thanks a bunch
__________________
------------------------------------------------------------------------- I thought what I'd Do was, I'd pretend to be one of those deaf mutes ------------------------------------------------------------------------ |
|
|
|
|
|
#2 |
|
Expert Programmer
|
Re: Does python have private variables in classes?
Python supports pseudo-private variables which are prefixed by two underscores: __width, for example.
|
|
|
|
|
|
#3 |
|
Unknown
Join Date: Apr 2008
Location: unknown
Posts: 87
Rep Power: 1
![]() |
Re: Does python have private variables in classes?
thank you so much.... its clear to me now....
__________________
------------------------------------------------------------------------- I thought what I'd Do was, I'd pretend to be one of those deaf mutes ------------------------------------------------------------------------ |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| more problems with copying from classes | cwl157 | Java | 0 | Sep 19th, 2007 5:17 PM |
| [tutorial] Python for programming beginners | coldDeath | Python | 30 | Dec 14th, 2005 12:35 PM |
| Convert Python script to C++ code | clanotheduck | Python | 17 | Sep 25th, 2005 9:55 AM |
| Advanced Python Tricks | Arevos | Python | 19 | Sep 24th, 2005 8:39 AM |
| Python - A Programmers Introduction | coldDeath | Python | 17 | Aug 19th, 2005 1:41 PM |