-5

Newbie Incoming, coming with a question about Unity, and C# in particular. This could be really simple, but I could not figure it out.

What's the difference between public and private mean? I don't get it. public, private, it boggles my mind. I just can't get it through my head, which doesn't happen very often. Can someone explain it to me like I'm five? It would really help me out on my journey of making a ball move across the ground. Thank you in advance.

Attacker3
  • 1
  • 1
  • public variables can be accessed by other classes. – DLeh May 15 '15 at 00:50
  • googling c# public vs private returns [Access Modifiers (C# Programming Guide)](https://msdn.microsoft.com/en-us/library/ms173121.aspx). that *should* answer your questions or at least allow you to ask a question in which you reference a specific issue and not just a general issue – psubsee2003 May 15 '15 at 00:52
  • 2
    Sorry... Unforgiving Community :'( I'll find somewhere else to go. – Attacker3 May 15 '15 at 00:58
  • 1
    @Attacker3: There is an excellent answer to your question at the linked duplicate question. As you can imagine, it's more effective to link to a single excellent answer than to have a whole bunch of mediocre answers to choose from. – Greg Hewgill May 15 '15 at 01:00
  • @GregHewgill But look at all the people saying that this post is crap. :( – Attacker3 May 15 '15 at 02:20
  • @Attacker3 This community requires you to do research before asking a question. Your question is very basic and is covered on various places. – aggsol May 15 '15 at 07:28

1 Answers1

0

Good night .

The difference is :

Private : Those variables or " functions" which may only be used in the source class .

Public : Those variables or "functions" that can be used in various class .

Classes: A class is a construct that allows create your own custom types by grouping variables of other types , methods and events. A class is like a blueprint . Defines the data and behavior of a type.