Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Tetriarch

Member Since 12 Jan 2011
Offline Last Active Today, 01:35 PM

#5246810 How can this code be refactored to be more proper OOP?

Posted by Tetriarch on 15 August 2015 - 08:15 PM

Okay, so to pour some clean wine... That code Alpha provided here is mine.. for my hopefully upcoming game Neon Flyers. Well we were discussing about Getters and Setters, and  I showed my code to Alpha and in this way he "overrunned" me and posted the code here.. That is okay but.. Id like to understand why in these modern ways of C++. Making getters and setters is not such a good idea for private members.. Well I understand that pivate member with public get/set methods is like having it public. But I always was taught my online tutorials etc.. that members in class should always be private or protected, if they are inherited.

So my question is how to work with it.. and how to avoid messing with get/set methods in such quantitive way as I have above.

 

As I see all your answers here it might be good if you had access to whole project but... project is in rewriting process, old repo is down, new has been made..  But true is that there already might be some misstakes done - considering to your asnwers here. https://bitbucket.org/Tetriarch/neon-flyers/src/9d05dd46d60c1f0a0ed32ed2aaf8997cf5ecbc40/neon-flyers/?at=master
I see the fact that I have done wrong decision, messed responsibilites of enemy class etc.. 

 

Well to be honest with such answer, which I dont claim is bad, because it ain't I have a bit problem to deal in matter of imagination how such code should look.. So I am asking whether there can somebody at least in some diagram or pseudo code show me how could I achieve that? So the project would be more object oriented?? 

Thanks a lot for help, Tetriarch.




PARTNERS