Carbon Programming Language - Classes, Inheritance, Interfaces and Generics in Carbon

Опубликовано: 09 Май 2026
на канале: AI Papers Academy
251
12

This video will cover classes in Carbon, the new programming language which is said to possibly be the successor of C++.
All code examples are working properly in the current language version which is 0.1.

If you are completely new to Carbon, you may get familiar with more basic syntax in this introduction video -    • Carbon Programming Language Syntax Introdu...  

The video will start with a very simple code example of a class in Carbon, to learn how to define and use classes in Carbon.
Then we will move on to learn about static functions in Carbon, which are not invoked on a class instance, and about member methods that are invoked on a class instance, and learn how Carbon distinguish between readonly methods which do not change the object they are invoked on, and mutating methods which do change the object.

Afterwards we will see how destructors work in Carbon.
We then will learn about inheritance in Carbon, which supports single inheritance.
Lastly we'll see how to define and implement interfaces in Carbon, and how generics work with Carbon using interfaces, by looking at generic functions and generic classes.

0:00 Introduction
0:39 Classes
2:13 Static Functions
3:14 Methods
4:21 Destructors
5:50 Inheritance
7:50 Interfaces and Generic Functions
9:56 Generic Classes