Re: how to handle a class object's data set?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Sam Hobbs (samuel_at_social.rr.com_change_social_to_socal)
Date: 01/08/05


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.



Relevant Pages

  • Re: Change resource dll list while runtime
    ... > resources, which the application goes through, searching for strings. ... I defined a struct called "Language", and I gave it a member variable for ... could load them from the resource file within the executable. ...
    (comp.lang.cpp)
  • Re: add support for other languages
    ... language DLLs or a single DLL with multiple language support, ... Just compile in Unicode ... You can create a hand-edited resource that contains Unicode strings, but you have to do it ... I don't know where is the language support comes into ...
    (microsoft.public.vc.mfc)
  • Re: Two Questions about "strlen", "strcat" and "strcpy"
    ... >>Important is that we have in the standard language a way of using ... > No. zero terminated strings is the whole problem in the first place. ... > programmer to think in terms of implementation and constantly respin ... The standards comitee refuses any change, ...
    (comp.lang.c)
  • Re: GNU gettext
    ... The gettext documentation explains how the keys work. ... translation files, or that you'd need to write a small utility to help ... gettext was desined for plain C, the keys are C strings ... as a developer you have no clue what every language ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: OOP and C++ and C (was Re: Dennis Ritchie -- An Appreciation)
    ... It's been said that there is a bias in C that favors arrays of structs ... struct record ... memory model, but that these are not issues specific in any way to C. ... a major overhaul of the language. ...
    (comp.lang.c)