You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
Object oriented programming is a programming paradigm based on the concept of "objects" and "classes", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).
Classes
A class is a template for objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods). Classes support inheritance, which is the ability to create a new class from an existing class. The new class is called a derived class, and the existing class is called a base class. The derived class inherits the base class's members, and can add its own members. Classes can also be used as interfaces, which is a mechanism for specifying the behavior that a class must implement.
Objects
An object is a unique instance of a data structure that is defined by its class. An object comprises both data members (class variables and instance variables) and methods.
Examples
In this example, the class defines a single method. When called, it prints the string "Hello, world." The example also creates an instance of the class and calls its method.
In this example, the class defines a constructor that takes a name as an argument and stores it in a member variable. The class also defines a method that prints a message using the name.
@Greeter{<
// self.name value will be nil by default
-name;
// Function that is called when the class is instantiated
~originator<self><name>{<
self.name = name;
>}
~greet<self>{<
println<format<"Hello {}"><self.name>>
>}
>}
~main<argc><argv>{<
greeter = Greeter<"World">;
greeter.greet<>; // prints "Hello World"
>}
As you can see, the originator function is called when the class is instantiated. And it is optional. If you don't define it, the class will be instantiated without any arguments, and the member variables will be set to nil.
Phases
For supporting the object oriented paradigm, will be three tow phases.
First phase [v0.3.0]
For this phase, the object oriented paradigm will be implemented without the inheritance.
Object oriented
Object oriented programming is a programming paradigm based on the concept of "objects" and "classes", which can contain data and code: data in the form of fields (often known as attributes or properties), and code, in the form of procedures (often known as methods).
Classes
A class is a template for objects, providing initial values for state (member variables) and implementations of behavior (member functions or methods). Classes support inheritance, which is the ability to create a new class from an existing class. The new class is called a derived class, and the existing class is called a base class. The derived class inherits the base class's members, and can add its own members. Classes can also be used as interfaces, which is a mechanism for specifying the behavior that a class must implement.
Objects
An object is a unique instance of a data structure that is defined by its class. An object comprises both data members (class variables and instance variables) and methods.
Examples
In this example, the class defines a single method. When called, it prints the string "Hello, world." The example also creates an instance of the class and calls its method.
In this example, the class defines a constructor that takes a name as an argument and stores it in a member variable. The class also defines a method that prints a message using the name.
As you can see, the
originator
function is called when the class is instantiated. And it is optional. If you don't define it, the class will be instantiated without any arguments, and the member variables will be set tonil
.Phases
For supporting the object oriented paradigm, will be three tow phases.
First phase [v0.3.0]
For this phase, the object oriented paradigm will be implemented without the inheritance.
Second phase [v0.4.0]
For this phase, the object oriented paradigm will be implemented with inheritance.
The text was updated successfully, but these errors were encountered: