Re: how to handle a class object's data set?
From: Sam Hobbs (samuel_at_social.rr.com_change_social_to_socal)
Date: 01/08/05
- Next message: Tom Esh: "Re: Is WM_COPYDATA special?"
- Previous message: ALESSANDRO Baraldi: "Re: how to handle a class object's data set?"
- In reply to: Bruno Köller: "how to handle a class object's data set?"
- Next in thread: Mike D Sutton: "Re: how to handle a class object's data set?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 8 Jan 2005 08:55:20 -0800
I know C++ a lot better than VB but perhaps it would help to explain what
the C++ equivalent would be. In the C language, a "struct" is like a VB UDT.
Something else that is not directly relevant is that the design of a struct
(I am nearly certain) was influenced by old-style fixed-format sequential
files. A C++ class is essentially a struct with functions (methods) added.
In C++, we can get the address of an instance of a class (a class object),
and the data for the class is at predictable offsets. The functions are not
addressable that way, but that is not relevant to your question (you did not
ask for them and I assume you don't need them).
I think it is unlikely there is a handle or anything like what you are
asking for, but I assume it is possible to get the address of the class
instance, which is probably what you are trying to ask about. If that is
possible, then one likely place to look is in the VB documentation
explaining how to interface with other languages, such as C++.
However you probably should explain why you need it. If you need to access
an instance of a class in order to interface with programs written using
another language, then you should look at the VB documentation of that. If
you need to interface with a COM/Automation/ActiveX (or whatever they are
called; Microsoft confuses us with their dynamic terminology) then there is
documentation for that too. I suspect you want an efficient way to read and
write class objects; I think that is called "persistance". Especially since
you say "data set". Generally speaking, it is better to not read and write
classes directly in that manner, for a variety of reasons. Compatibility is
one good reason to design your data to be more independent; and the word
"design" is an important concept to use for things such as this.
For example, in C++ if we use the new way for C++ programs to use strings,
then the class object does not have the string; it essentially only has a
pointer to the string. VB must be essetially the same; think about it. VB
strings (except for fixed-length strings) can vary in size from zero to many
thousands of characters. It is highly impractical (essentially impossible)
to reserve space for strings in a class instance. Then there are arrays,
variants, collections and other things that are essentially the same. So you
might spend some time developeing work-arounds, but you are likely to get to
the point where it would have been easier to use a more flexible solution. A
good design won't be a significant performance problem.
"Bruno Köller" <dontspam2bk@online.de> wrote in message
news:349qfvF4654kdU1@individual.net...
> Is there a way to address a class object's data set consisting of UDT
> variables and arrays together in one 'unit' and to refer to it by
> something like a handle ?
>
> My class object has several UDT variables and arrays representing a
> special set of data, and I want to handle one data set against another set
> without having to address each data item separately.
- Next message: Tom Esh: "Re: Is WM_COPYDATA special?"
- Previous message: ALESSANDRO Baraldi: "Re: how to handle a class object's data set?"
- In reply to: Bruno Köller: "how to handle a class object's data set?"
- Next in thread: Mike D Sutton: "Re: how to handle a class object's data set?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|