bzr branch
http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
5.1.3
by Gustav Hartvigsson
* Added the beginings of a hand written documentation. |
1 |
<!DOCTYPE html>
|
2 |
<html> |
|
3 |
<head> |
|
4 |
<title> The (Super) Simple Type System --Terminology </title> |
|
5 |
</head> |
|
6 |
<body> |
|
7 |
<h1> The (Super) Simple Type System -- Terminology </h1> |
|
8 |
<nav><a href="./index.html"> Back to Index </a></nav> |
|
9 |
<h2>Function</h2> |
|
10 |
<p> |
|
11 |
In the Super Simple Type System a function is what it is in standard C. |
|
12 |
No extra meaning is given to them here. |
|
13 |
</p> |
|
14 |
<h2>Method</h2> |
|
15 |
<p> |
|
16 |
In the Super Simple Type System a method is part of an object. |
|
17 |
In reality they are just function pointers that point to private |
|
18 |
C functions. |
|
19 |
</p> |
|
20 |
<p> |
|
21 |
most often methods are not to be accessed directly, even if it is |
|
22 |
possible, it is considered a bad idea, instead use the different object |
|
23 |
functions that accuses the methods. |
|
24 |
</p> |
|
25 |
<p> |
|
26 |
Methods are stored in the class object. In computer science terms it |
|
27 |
can be likened to an objects <code>v-table</code>. An example of this |
|
28 |
<code>deinitize ()</code> method that exists in all objects that has |
|
29 |
a class set that inherent from |
|
30 |
<a href="./object_types/SBaseObjectInstance.html"><code>SBaseObjectClass</code></a>: |
|
31 |
</p> |
|
32 |
<pre> |
|
33 |
typedef struct _FooClass FooClass; |
|
34 |
struct FooClass { |
|
35 |
SBaseObjectClass parent_class; |
|
36 |
void (* foo_method)(Foo *); |
|
37 |
}; |
|
38 |
</pre> |
|
39 |
<p> |
|
40 |
an instance of this object contains the same <code>v-table</code> as |
|
41 |
<code>SBaseObjectInstance</code> (and its own method), and as such you |
|
42 |
can use the <code>s_base_object_free ()</code> function on the object |
|
43 |
and the method will be run.<sup><a href="#fn1">[*]</a></sup> |
|
44 |
</p> |
|
45 |
<p> |
|
12
by Gustav Hartvigsson
* Made a few changes |
46 |
More on this on the <a href="./inheritance.html">inheritance</a> page. |
5.1.3
by Gustav Hartvigsson
* Added the beginings of a hand written documentation. |
47 |
</p> |
48 |
<footer style="padding-top: 10em"> |
|
49 |
<A name="fn1"><p> * Note: You must set your own deinit method, |
|
50 |
or it will use the <code>SBaseObjectInstance</code> deinit method.</p></A> |
|
51 |
<!-- <A name="anchor"><p> * Note </p></A> -->
|
|
52 |
</footer> |
|
53 |
</body> |
|
54 |
</html> |