Wow C++ is a nightmare when you are a noob at it! I'm building my notes, bookmarks, todo, whatever app in it. It is basically just parsing input from the user, and performing DB operations on it. It's essentially a super simple two column DB abstraction.
Apparently with C++ it is either 'all good in the hood' or 'OH HOLY CRAP THE EARTH JUST BLOWED UP!!!!!'. I'm trying to get a feel for what's best to put in a header file vs a class, trying to wrap my head around pointers (in real life.... they make perfect sense when explained, but when you dig in to use them... 'wait. what?!'), and classes in general in C++.
I worked forever and finally came up with a basic string splitting code block. So I could put the user's input into an array to work with. I have a Functions header so I can have global helper methods handy. I also have a DB header. I was thinking I would want that around everywhere and have it persist. All was good.
I created an Entry class. And defined a header with its definition in it. I created a variable of it and called its methods, all was good. Then I decided its database path should be a pointer to a path in the main so when it changes I don't have any maintenance to do. OH HOLY CRAP THE EARTH JUST BLOWED UP!!!!
I tried to track down what I was doing wrong and that only exploded the errors so they filled up the console. Ok. Nevermind. Later.
My database methods were in a header ao I could have a static callback method, for retrieving data. But I needed that header in main and Entry. Duplicate declarations. So I tried the compiler if/define trick. Nope. I made it into a class. After the earth blowed up a dozen more times I FINALLY got that to work.
So I guess I'm now a C++ guru. Ha.
No comments:
Post a Comment