Oh!, I still get the same error, and whenever i try to place the class declaration i got this error:
use of undefined type Anthony , what changes do i have to make in order to make my code work, thanks.. --- In [email protected], "mark" <anthonymor...@...> wrote: > > please help me, with this. im getting 2 errors > > 1. error C2653: 'Anthony' : is not a class or namespace name > 2. error C2248: 'Mark::id' : cannot access private member declared in class > 'Mark' > > i using visual c++ 2008 > > here is my code. > ---------------------------------------------------------- > #include <iostream> > > using namespace std; > > class Mark > { > public: > Mark(int x = 900): id(x){} > friend void Anthony::function(const Mark& mark); > private: > int id; > }; > > class Anthony > { > public: > int x; > void function(const Mark& mark); > }; > > void Anthony::function(const Mark& mark) > { > cout << mark.id << endl; > } > int main() > { > Mark m(122); > Anthony b; > b.function(); > return 0; > } > ----------------------------------------- > > please help me make this piece of code working.. > thanks!! >
