Languages Features Calendar About Lists Add Language
GitHub icon



Classes are a language feature.

In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods). In the terms of type theory, a class is an implementation鈥嶁攃oncrete data structure and collection of subroutines鈥嶁攚hile a type is an interface.

Languages with Classes include Java, JavaScript, Python, C++, PHP, Ruby, C#, Scala, Swift, Haskell, TypeScript, Kotlin, PowerShell, OCaml, Dart, Groovy, F#, CoffeeScript, Crystal, Chapel, Reason, X10, ABAP, Clean, SystemVerilog, Angelscript, Apex

Example from JavaScript, TypeScript:

class Person {}

Example from Python:

class Person (object): def __init__(self, name): = name

Example from Ruby:

# A tiny Person class in Ruby: class Person attr_accessor :name, :age, : # getter and setter methods def initialize(name, age) @name = name @age = age end end # Create a new Person object: person ="John", 30) puts puts person.age # Change the age of the person: person.age = 35 puts person.age

Article source

PLDB - Build the next great programming language 路 v2022 Docs Editor Acknowledgements Email GitHub