class Person {}
class Person (object):
def __init__(self, name):
self.name = name
# 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
Languages with Classes include JavaScript, Python, Java, C++, Ruby, PHP, TypeScript, C#, PowerShell, Swift, Scala, Haskell, Kotlin, CoffeeScript, Dart, Crystal, Reason, Groovy, OCaml, F#, Chapel, ABAP, SystemVerilog, Clean, X10, Angelscript, Apex, JS++, Speedie, Aardvark
Languages without Classes include C, C3, progsbase, C2
View all concepts with or missing a hasClasses measurement
Read more about Classes on the web: 1.