I am wondering, if the functions and classes are represented in the AST?
Certainly!
What is the possible data structure representation for the code?
It depends on the language you're parsing, so look at its grammar.
Some languages have a single, well-defined top-level construct, like "program" — you might find this in some version of Pascal, for example. For those you only need a single program-type node to represent the whole source unit.
Otherwise, you will need a collection oriented construct at the top level — it will look similar to what you would do for compound statements (e.g. { ... }
as a group of statements collected into a single statement). Perhaps, a single node that holds a list of declarations (e.g. types, data, or functions).
In other languages, sequential constructs are wrapped in a sequence node that only has two children (e.g. a left and a right), so to collect multiple statements or functions or constructs, the AST looks more like a linked list of other items.
But look to your grammar to identify what the top-level construct is. It may allow a series of declarations, for example, then you want an AST node that represents that.
An AST should reflect the grammar, but of course, since is abstract, it will not exactly do so, usually by omission — for example, a typical AST will not include nodes for parenthesis or intermediate productions(intermediate recognition), since the tree structure itself captures operator argument binding (having applied the appropriate operator precedence to operands during parsing).
On the other hand, a parse tree (aka concrete syntax tree) would probably reflect the grammar quite closely, including nodes for parenthesis, intermediate productions, keywords, etc..
As the parse tree is so verbose, it can be used to provide error messages that have an exactness regarding original source line and column.