call a member-function of a derived class

 

Hello again,

sounds simple but it didn't work:

1) class A has a public-function and it's body - working !

2) class B derives class A, function of class A is directly available and working !

3) in my indicator is a instance of class B, the public function of Class A is visible again, tells me its signature, everthing looks good. - But the compiler is crying: "'A::function…' - cannot call private member function" ????? But it isn't declared as private.


I hope you can get my trouble with this few words. And i hope, there is a simple thing to tell the compiler taking the function as public. Same as declared in the instance. To double the body or a code-through will kill my easy design.


EDIT - here with a abstract of code

_______________________________
class A
  {
private:

public:
                     int getData() {return 12;};
  ...
  }

_______________________________

class B : A
  {
  ...
  }  

_______________________________

B objTest;

int t = objTest.getData();   // This line makes me trouble...



Thanks in advance !

 
You are expecting coding help without posting code ?
 
angevoyageur:
You are expecting coding help without posting code ?
That's what i was afraid of... I will try to reduce the stuff to be readable in time :-)
 
If the compiler is saying that your method is private, there is 99.999% chance it is. Check your code.
 
angevoyageur:
If the compiler is saying that your method is private, there is 99.999% chance it is. Check your code.

come on, this is crule. I checked it a minute ago. It's NOT working on my system. The code above with remarks.

class A
  {
private:

public:
                     int getData() {return 12;};
  }
;
//_______________________________

class B : A
  {
  }  
;

//_______________________________

B objTest;

int t = objTest.getData();   // ERROR: 'A::getData' - cannot call private member function	texxx.mq4	35	17

 
Abejorro:

come on, this is crule. I checked it a minute ago. It's NOT working on my system. The code above with remarks.


class B : public A
 
angevoyageur:

Ahhhh, yes that's it ! - Thanks a lot ! - - *g* I'm missing your LOL ;-)
 
Abejorro:
Ahhhh, yes that's it ! - Thanks a lot ! - - *g* I'm missing your LOL ;-)
I removed it as I missed the point at first. ;-)
Reason: