call a member-function of a derived class

Back to topics list To post a new topic, please log in or register
avatar
39
Abejorro 2015.03.04 00:32
 


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 !

avatar
Moderator
3206
angevoyageur 2015.03.04 00:35 #
 
You are expecting coding help without posting code ?
avatar
39
Abejorro 2015.03.04 00:39 #
 
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 :-)
avatar
Moderator
3206
angevoyageur 2015.03.04 00:54 #
 
If the compiler is saying that your method is private, there is 99.999% chance it is. Check your code.
avatar
39
Abejorro 2015.03.04 00:59 #
 
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


avatar
Moderator
3206
angevoyageur 2015.03.04 01:06 #
 
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

avatar
39
Abejorro 2015.03.04 01:19 #
 
angevoyageur:

Ahhhh, yes that's it ! - Thanks a lot ! - - *g* I'm missing your LOL ;-)
avatar
Moderator
3206
angevoyageur 2015.03.04 01:25 #
 
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. ;-)
Back to topics list  

To add comments, please log in or register