Am I doing this right? Object Usage.

I've taken an intro java course, and have been attempting to teach my self C++. This is my first attempt into any real OOP stuff, and I'm not sure I'm doing it right. My question is really language independent. How should I be using objects?

I've basically been using them as function storage containers, to clear up my main on larger projects.
For example:

I'm working on a project to enter information about feeding/changing diapers for babies that stored in a file. Which can then be analyzed for statistics. The first object I created is used to work with the files: read, write, erase,etc.
so its usage would look something like fileWork.write("string");

I feel like I'm missing out on something with using objects. thanks!
An object is a container for methods and data (might not be the technically correct terms, but you get my point), objects call methods of other objects, to get data or have something done. I found a good website that might be better than me babbling on:

http://christophergrant.org/2009/12/07/object-oriented-thinking-for-the-procedural-programmer/

Hope it helps. Otherwise get a good book. Thinking in C++ or Thinking in Java
Use objects to organize complex ideas WHEN YOU NEED TO. There is nothing stopping you from using procedural programming in C++ because in some cases creating an object for a problem would just be stupid.

Let's say you want to write a program to find and delete a certain file. The entire scope of the program is 1.) Look in the directory for the file 2.) If the file is found then delete the file, if not then move on to the next directory. Why would you bother to create an object to do this?

Now if you wanted to create a program to simulate traffic on a thruway that would be different. Each car would have a different location, vector and mass. They all have those properties which are unique to that particular instance of that car. In this case it makes sense to make each car into an object to help organize the data and code.
Why would you store babies in a file?! YOU MONSTER!
Topic archived. No new replies allowed.