Submitted by Mi-K on Tuesday, February 28, 2012 - 1:45pm
OK, this is not really a getter implementation like we can have it in other object-oriented programming, but it is close of it.
We have first to create an human variable with a tuple ("name", age).
Then we have to create two getter functions to retrieve the first and the second parameter of this human variable.
Submitted by Mi-K on Tuesday, February 28, 2012 - 9:22am
OCaml is a fully recursive language. So using recursion is completely natural.
We will see in this example how to create an easy recursion of a classic factorial. This in two different manners.
These two ways of using recursion are strictely the same, the type of the function and the result as well of course.
Submitted by Mi-K on Monday, February 27, 2012 - 1:37pm
When you use OCaml on Linux for example, you cannot by default using the arrow from your keyboard, neither the completion.
If you try to use them you will have something like that:
# ^[[A^[[D^[[C^[[B^[[D^[[A^[[C^[[D^[[B^[[C
But there is readline wrapper named rlwrap that will help us in this task!
Submitted by Mi-K on Wednesday, February 22, 2012 - 2:45pm
It is sometimes useful to display the current date in your terminal.
For that the time() system call function is the best one.
Let's see an example within this tiny tutorial of C programming language:
Submitted by Mi-K on Sunday, January 15, 2012 - 5:43pm
The virtual keyword is used in different ways in C++.
The most common way to use it is before a destructor.
Indeed, with this virtual keyword we can specified that the children of a class will be deleted before its parent.