Click to See Complete Forum and Search --> : meta classes


siva
March 29th, 1999, 09:09 AM
Hi,

I want to know about meta classes and what are their uses etc.

Can any one give information about it?

Thanks in advance,

siva

Dave Lorde
March 29th, 1999, 09:45 AM
As I understand it, a meta-class is a class whose instances describe other classes in some way; for example, MFC's CRuntimeClass could be called a meta-class because an instance of CRuntimeClass provides information about it's associated runtime class type.


I would expect meta-classes to be used to create instances of the classes they describe, or for runtime documentation of classes.


Java has a class called Class that has an instance for every class or interface loaded into the JVM, and allows you to get details about the class, its type, methods, fields, and inheritance, and to create new instances.


Dave

Bolo
March 30th, 1999, 06:35 AM
In addition to what Dave said I give another example for the use of meta classes:

If you ask your class - during runtime - for the number of it's attributes you

will have no success (unless you are programming in Smalltalk).

If you want to program a DataBaseFramework (Obj.Or. access to SQL) you will

face the problem to generate an SQLquery dynamically for different obj. with

different attributes for your DB-Ops. Here you need to iterate over all of the

attributes. A meta class can give you an array with the apropriate attributes,

everytime you want to generate an SQL.


bye Bolo