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