170 похожих чатов

Is Go an object-oriented language? Yes and no. Although Go has

types and methods and allows an object-oriented style of programming, there is no type hierarchy. The concept of “interface” in Go provides a different approach that we believe is easy to use and in some ways more general. There are also ways to embed types in other types to provide something analogous—but not identical—to subclassing. Moreover, methods in Go are more general than in C++ or Java: they can be defined for any sort of data, even built-in types such as plain, “unboxed” integers. They are not restricted to structs (classes).

Also, the lack of a type hierarchy makes “objects” in Go feel much more lightweight than in languages such as C++ or Java.

2 ответов

3 просмотра

https://golang.org/doc/faq#Is_Go_an_object-oriented_language

Ну тут фактически всё сводят к наличию таблицы виртуальных функций

Похожие вопросы

Обсуждают сегодня

Интересно, нет ли какого-то способа получить из dll не адрес самой метки, а адрес со смещением?
The Bird of Hermes
54
generic procedure function test<T>(param: T); type case T of longint: NewT = word; longword: NewT = byte; end; var v1: NewT; Как это можно сделать? Чтобы у меня...
notme
21
Делал задачу вот такую https://stepik.org/lesson/4985/step/9?unit=1083 получилось такое https://play.haskell.org/saved/ipKrepqe оно работает, тестов много не писал, но работае...
Fedor
22
Хотел уточнить: копирование из одного рекорда в другой однотипный рекорд можно только по полям отдельно или можно чохом, типа Assign?
Ed Doc
9
Похоже опять туплю задача https://stepik.org/lesson/5431/step/8?unit=1132 код и его работа https://play.haskell.org/saved/lmYTShXM на мой взгляд все правильно, и даже избыто...
Fedor
8
Всем привет, подскажите, пожалуйста, сколько живет connection к рэббиту, могу ли я использовать один инстанс подключения? Если да, то считается ли это хорошей практикой? Вот п...
Sergey
3
Sometimes I like to solve problems the hard way. What do I mean? You know many problems can be fixed by restarting the system, but how much do you learn about the system? P...
Matthias Hoffmann
1
что-то я не понимаю, в линуксе отладочную информацию как убрать из бинаря? он что с этой опцией, что без - одного и того же (достаточно большого) размера (да, я про лазарь)
Iluha Companets
13
Anyone here suffers from unexplained aural migraines, who would be up for talking for a bit? Doesn't *have* to be aural, but I am not asking about headaches, I mean actual mi...
Martin Rys
58
Hey Does anyone know how can I receive push notifications from Github on my account? The official Github android app doesn't send notifications, and I don't use the email bec...
Jacob
10
Карта сайта