I have a Drupal 7 site with 40 content types. When Drupal 8 will be released than I would like to migrate these content types.
Would this be possible, or would I have to create this content types from scratch?
I guess the best place to search for upgrade process is UPGRADE.txt file. Here you can find the step-by-step approach to follow in upgrading the site from Drupal 6/7 to Drupal 8.
Drupal 8 core will include a robust data migration API: https://drupal.org/node/2121299, part of the IMP initiative: https://groups.drupal.org/imp . Also you can check the recently updated list of modules that are included in Drupal 8 core: http://blog.merge.nl/2014/01/21/drupal-which-drupal-7-modules-went-into-drupal-core
Few of the links that you check:
You can try to "upgrade" using the D8 core migrate module. Also install the contrib module migrate_plus. It allows you to convert custom content types, users, comments, taxonomy, etc. Most common fields should be covered. If you got something really custom going on, like a custom module, you'll also have to do some programming. But if you only used the essentials of D7, migrate might have you covered. In any case you'll have to rebuild a new site and migrate the content there, so it's not a painless solution in any sense.
Your most up to date documentation is found here: https://www.drupal.org/upgrade/migrate