ELI5: Explain Like I'm 5

Forward declaration

When you are a child, you can't always see everything that's going on around you, so you might need your grown-up to tell you what's going to happen or who's going to come over. This is kind of like a forward declaration!

In computer programming, a forward declaration is when you tell the computer that something is going to exist later in the program, even though it hasn't been fully created yet. This can be helpful if you have code that needs to use that thing, but it doesn't actually need to know what the thing looks like or how it works.

For example, let's say you are making a program that uses a class called "Dog." You know you're going to need the Dog class in your program, but you don't need to use everything about it just yet. So you can do a forward declaration by saying something like, "Hey computer, there's going to be a thing later called 'Dog,' but I don't have all the details yet. Just trust me, it's going to be there." Then, when you actually create the full Dog class later in the program, the computer will already know about it and be ready to use it.

So, basically, a forward declaration is like telling the computer that something is going to exist later, even if you don't have all the details yet. It's like telling a kid that their friend is coming over later, even if you don't know exactly what time or what they're going to do together yet.