returning values from a class?

A

Andy B

I need to make a class and not quite sure how to go about doing this part. I
want the class to take user input, build a dataset based on that input and
then return it from the class so it can be used elsewhere. A few things
about the dataset and the class that builds the dataset:

1. The dataset should already have prebuilt tables and columns that need to
be filled in like Header, Sections, Glossary, FormHeader, Contacts and
FormFooter. The other table, EventsForm has to be created "on the fly".
2. The class that generates the dataset needs to have different methods. A
method for each table and one for actually returning the dataset to an
application for use.

Where would I get started doing something like this? I do know how to make
classes in general, but not using "global" objects in a class.
 
Z

zane546

I need to make a class and not quite sure how to go about doing this part.I
want the class to take user input, build a dataset based on that input and
then return it from the class so it can be used elsewhere. A few things
about the dataset and the class that builds the dataset:

1. The dataset should already have prebuilt tables and columns that need to
be filled in like Header, Sections, Glossary, FormHeader, Contacts and
FormFooter. The other table, EventsForm has to be created "on the fly".
2. The class that generates the dataset needs to have different methods. A
method for each table and one for actually returning the dataset to an
application for use.

Where would I get started doing something like this? I do know how to make
classes in general, but not using "global" objects in a class.

I'm not sure I understand the question. If you are asking about the
simplest/most common way to have a class accept input and return a
DataSet is to create a method which takes the input as the arguments
and returns the DataSet it builds:

DataSet myOperation(argument1, argument2, ...)

Exposing internal variables and objects of a class is generally not a
good idea, since other classes may change these variables - even to
illegal values - without the class knowing about it, causing problems.
The idea of using methods to access internal variables is to have the
class know which variables are being modified (and restricting those
which cannot), and also to validate any data given as input.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top