other class cant change variables in another class.

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: other class cant change variables in another class.

Post by programmerinprogress »

Yeah it's much better practice to restrict immediate access to your variables, accessor methods help prevent unwanted mistakes bugs and errors (or deliberate hacks from users of your class).
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: other class cant change variables in another class.

Post by eatcomics »

LeonBlade wrote:Yeah he is...

If you want to change variables, use a Public Get/Set
Good to know I'm doing things right :mrgreen:
Image
Post Reply