PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Classes

Classes

Classes are a 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, C#, Ruby, Swift, Scala, Haskell, TypeScript, Kotlin, PowerShell, Dart, Reason, Crystal, F#, OCaml, CoffeeScript, Groovy, Chapel, ABAP, X10, Clean, SystemVerilog, Angelscript, Apex

Example from JavaScript, TypeScript:
class Person {}
Example from Python:
class Person (object): def __init__(self, name): 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 = Person.new("John", 30) puts person.name puts person.age # Change the age of the person: person.age = 35 puts person.age
binary-operators-feature.html 路 classes-feature.html 路 conditionals-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 33 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com