class Person {}
# 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 Java, JavaScript, Python, C++, PHP, Ruby, C#, Swift, Scala, Kotlin, PowerShell, Haskell, TypeScript, Dart, Reason, Crystal, CoffeeScript, F#, OCaml, Groovy, Chapel, ABAP, X10, Clean, SystemVerilog, Cython, Speedie, Angelscript, Pizza, Apex, JS++, Oracle Java, Deesel, Real-Time Concurrent C, Static Typescript
Languages without Classes include C, Objective-C, C3, progsbase, C2, Tick C
This question asks: Does the language have a concept of classes?
Read more about Classes on the web: 1.
HTML of this page generated by Features.ts