Closed nhalstead closed 4 years ago
The issue here is not the access modifier, but instead it's because the block class is not static. At the end of the error it says x.new A() where x is an instance of Pixy2CCC
, meaning that in order to create a new Block, you need an instance of Pixy2CCC. You should be able to use the Pixy2CCC object provided by the main Pixy2 class to instantiate a new Block with something like pixy.getCCC().new Block()
I will look at the code later today to see if it would make sense to make the class static however.
Ahh. I see, I did take notice to this earlier and tried to write the same block of code you have put in the last comment and failed and lead myself down the wrong diagnosis, but I see the correct way to do it now.
Thanks, as far as making that class static, I don't see a reason to not have it static considering it does not depend on anything within the the Pixy2CCC class instance. Additionally a weak reason to have to have it separate is just how the community tends to organize classes is by putting them in their own files, not saying correct or wrong its just what is commonly seen.
The new version 1.4 makes these classes static, as like you said, they do not reference anything non-static and are not tied to the specific instances of their respective container classes.
I also added some other changes I had fixed to to keep the API as similar as possible to the original C++ Pixy2 API.
Thanks for your help!
When making some helper functions to adjust some of the values of the Block Instance, I got an error when trying to make a new instance of the Block Object.
Here is the error I get from the IDE (VS Code) about creating a new Instance of Block.
Yes I do see that this is related to issue #4 but I feel that this is a good reason to expose this class as public.
Here is some of the code that I can using to create a new instance and if interested later on in the season I could make a pull request to add in features from what I have added here.