Brain bug or Berry Bug? #20136
-
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
I'm confused. You are mixing instance values and global values (id_counter_sensor) which is a bad practice. Then you are not creating a single instance with this class, which makes it useless. Then you are calling a method through a class identifier and not an instance method. You can't do that. Either declare the method as Internally when you declare a method like |
Beta Was this translation helpful? Give feedback.
-
i understand your confusion. That was only a snippet. A have a class Sensor and more than one subclass (like Buttons or PIRs). That is a try do make a method in mainclass to iterate all or hole subclasses. I am relatively new on object-oriented programming and Berry. So i try to find options ;) Your last Info give me the reason for that behavier. But i do not no what the declaration of sure, i could workaround by giving an extra parameter in first. But is there a better way? thx alot! |
Beta Was this translation helpful? Give feedback.
-
it seems to be an other or additional problem. |
Beta Was this translation helpful? Give feedback.
Here is the documentation for
static
methods:https://github.com/berry-lang/berry/wiki/Chapter-6#class-methods-static