c++ Can a class contain a class member that is friends with it? -


i have class called restaurant contains employee member. employee friend class of restaurant. when try compile errors on employee mcurrentemployee saying missing type specifier - int assumed. why compiler mad @ me this? ideas on how can fix it? thanks.

#pragma once #include "employee.h" class restaurant{     friend class employee;  private:     employee mcurrentemployee;  }; 

-

#pragma once #include "restaurant.h" class employee {  } 

if remove include of "restaurant.h" employee should resolve friend issue (you may need use forward declarations code compile it's impossible given minimal code you've shown us).

that said should ask why employee needs friend of restaurant in first place.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -