POV-Ray : Newsgroups : povray.off-topic : Povray versus Objective-C: objects : Re: Povray versus Objective-C: objects Server Time
28 Jul 2024 22:19:46 EDT (-0400)
  Re: Povray versus Objective-C: objects  
From: Warp
Date: 21 Oct 2012 08:54:26
Message: <5083f082@news.povray.org>
gregjohn <pte### [at] yahoocom> wrote:
> My purpose here is to wrap my head around ObjC.

An object is an instantiation of a class. (In ObjC such an instantiation
is created by calling the 'alloc' method of such a class, and then calling
a constructor to initialize it.)

There are two things that make an object special and different from other
types of first-class citizens (such as ints): They (may) have methods (ie.
member functions), and the object you are handling might actually be of a
different (but usually inherited) type than what the actual code says.

In other words, if a function takes, for example, a parameter of type
MyClass*, then it may be called with an object that's actually not of
type MyClass but something else. (Usually it will be an object of a class
that has been derived from MyClass.)

You can then call the methods of that object (or, more technically speaking
in the context of Objective C, send a message to it). The method
implementations may be those that were implemented for MyClass, or they
might have been re-implemented in whatever derived class the object is.
(The thing is, this function doesn't need to know this in order to work.)

Since you are asking about Objective-C I'm assuming you are trying to
make an iPhone program (or at the very least a MacOS X one). Trying to
do so without understanding object-oriented programming can be a pretty
daunting task. It could take years to master.

-- 
                                                          - Warp


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.