Original Post
Background: using C#
I just finished developing a "prototype" for a game I may want to develop sometime in the future. It all worked well and I was able to accomplish what I wanted to develop. The game itself has over 30 classes! The main class would probably be the ingame.cs class, the ingame class creates instances of -has- relationships (other classes), the thing is though I want these -has- relationship classes (i.e. World.cs, Downloader.cs, Uploader.cs) to have the ability to talk back to the main ingame.cs class and any other -has- relationships within the main ingame.cs. This has caused me to mark everything as public. By marking everything as public I am basically ignoring the whole encapsulation pillar of OOP.
So here is the question: What is the point of encapsulation? I can understand its use in libraries that may be shared to other programmers later on, but in this case what is the point? How can i implement encapsulation in this scenario (and this scenario will probably apply to any game that involves many classes)?
Replies are appreciated,
Thanks, Xanather.
I just finished developing a "prototype" for a game I may want to develop sometime in the future. It all worked well and I was able to accomplish what I wanted to develop. The game itself has over 30 classes! The main class would probably be the ingame.cs class, the ingame class creates instances of -has- relationships (other classes), the thing is though I want these -has- relationship classes (i.e. World.cs, Downloader.cs, Uploader.cs) to have the ability to talk back to the main ingame.cs class and any other -has- relationships within the main ingame.cs. This has caused me to mark everything as public. By marking everything as public I am basically ignoring the whole encapsulation pillar of OOP.
So here is the question: What is the point of encapsulation? I can understand its use in libraries that may be shared to other programmers later on, but in this case what is the point? How can i implement encapsulation in this scenario (and this scenario will probably apply to any game that involves many classes)?
Replies are appreciated,
Thanks, Xanather.