Discussion Locked

Objects,Objects, Objects

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I'm trying to understand the concept of object class and object instances. Please explain and give an example of both an object class and object instance as it relates to the Semantic Object Model (SOM). I've studied OOM's but not SOM. Describe whatis meant by simple and composite objects and give an example of each.

5 replies

by thechas

Not necessarily an answer.

Have you looked at TR's sister site
www.builder.com.com

A while back, TR split off the programming language content to a separate site.
I subscribe to some of their e-mails, and recall a series of articles on OOP (Object Oriented Programming.

I find most of the articles are clearly written and easy to understand.

Chas

by rawright

This site may give some clues: http://personal.cityu.edu.hk/~ismikeho/dm2/som.htm

The difference between an object class and an instance is much simpler - the class is a definition of a type of object, much like a struct defines the layout of a section of memory for data. You can't use either until you create an instance of it in a program. For example:

class foo{
int x;

int getx(){
return x;
}
int setx(int i){
x=i;
}
}

defines a class, foo. It isn't useful for anything until you instantiate it:

void main(){
foo f;
int i;
f.setx(3); // Sets x = 3 in f
i=f.getx() // Returns 3 into i
}

The class is foo; f is an instance of class foo.

by d_gilmour_1978

Think of it this way

A object class is like the plans for a house

and object instance is like the actual house based on the plans

from one object class you can create many object instances. Just like you can make many identical houses from one set of plans

by d_gilmour_1978

Think of it this way

A object class is like the plans for a house

and object instance is like the actual house based on the plans

from one object class you can create many object instances. Just like you can make many identical houses from one set of plans

This discussion is closed to new replies.