Creating an object of user def. class in another user def. class

hi. could someone please tell me if it is a syntax error if i create an object of a Document class in a class ViewDoc's function-ViewDoc is friend of Document-, however i dont define class Document in the same file as the ViewDoc class (i define ViewDoc in the same file as main())
i wanna do something like this
1
2
3
4
5
6
7
8
class ViewDoc{
      void fun(){Document doc;}
};

int main(){
    ViewDoc VD;
    VD.fun();
return 0;}


ViewDoc is declared as friend in Document's definition.
That is OK, you can use classes in the same way you use basic types
Topic archived. No new replies allowed.