Re: Q's about Obj-C
Re: Q's about Obj-C
- Subject: Re: Q's about Obj-C
- From: Ondra Cada <email@hidden>
- Date: Tue, 16 Oct 2001 12:01:48 +0100
Bradley,
>
>>>>> Smith, Bradley (SB) wrote at Tue, 16 Oct 2001 09:16:39 +0100:
SB> If you want to be able to call a function outside of that translation
SB> unit then you do indeed need to prototype (declare) your function in your
SB> header file.
That's not true.
SB> Think of functions declared in the header as public and ones
SB> not declared in the header as private.
Don't think so, since it's wrong.
SB> So, my question is does the same / similar rule apply to Obj-C messages /
SB> methods?
It does not, since there is _no such rule_ in plain C:
178 /tmp\> cat > q1.c
int fubar(int i) { return i*i; }
179 /tmp\> cat > q2.c
void main() {
int i;
for (i=0;i<5;i++) printf("%d^2=%d\n",i,fubar(i));
}
180 /tmp\> cc q1.c q2.c && ./a.out
0^2=0
1^2=1
2^2=4
3^2=9
4^2=16
181 /tmp\>
SB> >(i) for a moment, forget ObjC completely. We are in plain C,
SB> >and we speak
SB> >functions. Now,
SB> >
SB> >- you don't have to declare a function;
SB> >- function name is sufficient so as the proper function is called;
SB> >- you have to beware though that the argument types and
SB> >return values are correct.
SB> >
SB> >This is something you should know very well, in case you are
SB> >an experienced
SB> >C programmer. Right?
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
2K Development: email@hidden
http://www.2kdevelopment.cz
private email@hidden
http://www.ocs.cz/oc