Sorry if this was asked before, and if it was, just drop a link. I'm fairly new to C++.
I have a project that requires me to create a Twitter-like program; where each User has their own wall, homepage, friends list, inbox, etc. The problem is is that I have to turn in one .cpp file; I have to put all classes on one file. Now since C++ reads from top to bottom, I'm having an issue with creating/referencing other classes because they haven't been defined yet.
For instance, since User contains an object made from my FriendsList class, I have to put FriendsList first, but then there's an issue where I can't make an array that holds User because User hasn't been defined yet.
Sorry if this is a stupid question.
Edit: How would I go about forward declaration?
class FriendsList;
class User()
{
FriendsList* friends;
//constructor and other stuff
};
class FriendsList()
{
//stuff
};
Would it be like that? Sorry I'm just confused.