I have a class “baseShape” that extends ofRectangle, this is going to be my main class. From this class i derived other class named “boton” so i ended with a class called button witch extends “baseShape”.
When i try in the class “boton” to get a var or a method from his parent class “baseShape” i allways get an error
main class “baseShape”
class baseShape : public ofRectangle {
public:
baseShape();
~baseShape();
........
boton class extends baseShape
class boton : public baseShape {
public:
boton();
~boton();
....
it seems like in this class (“boton”) the constructor of the parent class was not called so i dont have access to the parent class properties or methods.
btw, an XCode project is not useful to all users, so it’s often more useful to just post the code of a minimal/reduced example which shows your problem.
im sorry about the project, your are right its better to explain what im doing wrong… so this can be usefull for anothers.
Im doing is a class “fichaInfo” that its made by various rectangles connected with springs, in the header file of that class i have the following pointers:
i declare here the pointers because i want to call them independientemente
and a vector to store all the pointers, i use a vector because i need to loop them to set a repulsion force between the shapes
vector<baseShape*> rectangulos;
I assumed that when you declare a pointer in the header file, the object is automatically created, but im wrong. So later i have to initialize the pointer to use in a function.
sorry, i didn’t finish that reply. you are right, those would both work the same. what i meant to point out was that if you declare a pointer in the header and allocate it, it should only be pushed once to the vector, but re-reading it looks like you are not doing that at all. you should, however, be able to access the methods from your pointer, but its hard to tell why that is not working…
I can access to the methods thought the vector, but not from the declared pointers in the header… seems like its not a good way of doit so i take another aproach