C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re: "Dynamic" Object Structures?

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Randy Yates
Guest





PostPosted: Thu Dec 30, 2004 4:27 pm    Post subject: Re: "Dynamic" Object Structures? Reply with quote



=?ISO-8859-15?Q?Juli=E1n?= Albo <JULIANALBO (AT) terra (DOT) es> writes:

Quote:
Randy Yates wrote:

The closest I can come is to define a recordset object that has a member
function

void * Fields(char* fName);

so that I can say

int year;
recordset rstCars("SELECT * FROM tblCars");

year = rstCars.Fields("fYear");

Is this a reasonable way to do this? Is there any mechanism in C++ to
do it more elegantly?

You can write an operator [ ] or operator ( ) instead of a function. But
surely many people will disagree about what way is more elegant.

That sounds like a great idea - at least the syntax would be even closer
to VB.

Quote:
You can also create a Field class, create objects of this class with the
field names, and use those objects as parameters instead of string
literals.

Don't want to do that - duplication of effort. The fields should be inherently
identified by the class via the SQL query text.

Thanks for the ideas!
--
Randy Yates
Sony Ericsson Mobile Communications
Research Triangle Park, NC, USA
[email]randy.yates (AT) sonyericsson (DOT) com[/email], 919-472-1124

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.