<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../style.css">
<title>
Gambas Documentation - Object
</title>
</head>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../help+en"><img class="flag" alt="Home" border="0" src="../../../img/lang/en.png" align="center"></a>&nbsp;
<a href="../type+en">Up</a>&nbsp;
<a href="long+en">Previous</a>&nbsp;
<a href="pointer+en">Next</a>&nbsp;
</td></tr></table>
<div class="notab">
<h1>
Object
</h1>
<div class="black"><font size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><b>DIM</b> Var <b>AS</b> <b>Object</b></pre><p>

This datatype represents an anonymous reference to a <a href="../../def/gambas+en">Gambas</a> object.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../../img/warning.png" align="center"></td><td valign="top">
Using anonymous references is slower than using references whose class is known at compilation time.
</td></tr></table></div>
<p>
You create new object with the <a href="../new+en">NEW</a> keyword, or by using special instructions like <a href="../open+en">OPEN</a>
that creates files, or <a href="../exec+en">EXEC</a> and <a href="../shell+en">SHELL</a> that creates processes.
<p>
Objects are automatically freed when they are not referenced anymore.
<p>
The freeing process is based on a reference counter stored in each object.
There is no garbage collection in <a href="../../def/gambas+en">Gambas</a>.
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../../img/warning.png" align="center"></td><td valign="top">
If you create a cross referencement, i.e. if an object <tt>A</tt> has a reference on an
object <tt>B</tt>, that itself has a reference on <tt>A</tt>, then the objects will never be
freed.
</td></tr></table></div>

</div>
</body>
</html>

