Shariing Public Class functions
Posted on 2003-11-02
Hello, Im new to c++, so....
I have 2 headerfiles, one class in each, with various public functions (Accesors etc..) The functions corresponding with each header file are defined in thier own seperate .cpp files. And there is a main of course. So thats five files..
I believe what I am trying to do is aggregation, I want to access a private value from one object to be used in a method from the other object. So what I assumed would work is calling the public accessor method from the class that I want to retrieve the value from. But... I am getting the following compilation error
In function 'void feed()'
'getAttributes" undeclared (first use this function)
I have each seperate header included. so that cant be the problem. I know the problem is when I try and call that function its not aware of its existance because I am calling it from inside another class.. My question: Is there any way that I can allow one class to retrieve a private variable from another using the public accessor method from the class where the private value resides?