473,686 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Declaration of arrays

L.S.,

I have three classes: SchoolClass, Student and Main.

Within main I call Schoolclass in which a load method resides. What load
basically does is reading with BufferedReader the contents of a text file.
Within schoolclass.txt you have the values 'student: grade' on a maximum of
forty lines.

Within the Schoolclass class I read the contents of the text file into an
array. I succeed in this from within the SchoolClass class. But when I am in
the main, I want to reprint the contents of the array. ClassArray[i] from
Main returns null, so it is basically refering to an empty reference. Can
anybody give a simple example of how to use an array declared and filled
within another class?
So:
Main -> print content of array again, declared and filled in SchoolClass
SchoolClass -> read text file and fill array and print content on screen
Student -> just a blueprint for a student (1 element of array(String name,
double grade))

Many thanks for your respons.

Grtx,
Novum
Jul 17 '05 #1
1 3045
L.S.,

I already found the solution myself. RTFM worked again.

Grtx,
Novum

"Novum" <no***@NOSPAMwa nadoo.nl> schreef in bericht
news:42******** *************** @news.wanadoo.n l...
L.S.,

I have three classes: SchoolClass, Student and Main.

Within main I call Schoolclass in which a load method resides. What load
basically does is reading with BufferedReader the contents of a text file.
Within schoolclass.txt you have the values 'student: grade' on a maximum of forty lines.

Within the Schoolclass class I read the contents of the text file into an
array. I succeed in this from within the SchoolClass class. But when I am in the main, I want to reprint the contents of the array. ClassArray[i] from
Main returns null, so it is basically refering to an empty reference. Can
anybody give a simple example of how to use an array declared and filled
within another class?
So:
Main -> print content of array again, declared and filled in SchoolClass
SchoolClass -> read text file and fill array and print content on screen
Student -> just a blueprint for a student (1 element of array(String name,
double grade))

Many thanks for your respons.

Grtx,
Novum

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3179
by: Anoop | last post by:
Hi guys i have a piece of code main() { switch(...) { case 1: {
5
2745
by: j0mbolar | last post by:
operator = (const char *string) { if(m_string) { free(m_string); m_string = 0; } if(string) { m_string = strdup(string); } }
16
41766
by: herbertF | last post by:
Hi guys, In a program (not my own) I encountered the declaration of a constant pointer to an array consisting of two other const pointers to arrays. Not quite sure why they do it so complicated, but is it legal? Most compilers accept it, but one doesn't recognize the rhs as a constant. What are the requirements for the rhs in the declaration of a const pointer? Is the following program legal C? int main(int argc, char *argv) {
7
2189
by: Jacob Schmidt | last post by:
Could anyone correct the error in my logic here?: #include <stdio.h> #include <stdlib.h> main () { const char message1 = {"\nCurved portion of graph -- D.G.A.C.\ \n A B C"}; const char message2 = {"\nCurved portion of graph -- R.A.C.\ \n A D E"};
31
5002
by: RS | last post by:
Hi, Looking to see if the following construct is valid: typedef struct { int foo; char bar; } foobar; Basically, the idea is to have the structure above point to a message buffer that has a 4-byte integer followed by a stream of variable
3
1773
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef System::Byte ByteArray __gc;
2
3336
by: Michael Schöller | last post by:
Hi I have some "unusual" problem ^^ Is there an way to enforce the declaration of values? If the answer is no use propertys can anyone tell me how to access a construct like this over properties. Access should be easy like ....some code Memory m; ....some code byte v = m.complete;
11
2603
by: Martin Eisenberg | last post by:
Hi Antoine, just redirecting you... Antoine Trux wrote: > Hi, > > Is the following code legal: > > ------> code starts here <------ > #include <stddef.h>
21
22914
by: vito | last post by:
how to achieve that? it seems php doesn't support it well for a C programmer? i hope to use something like: a; a; a;
10
5962
by: Stephen Howe | last post by:
Hi Just going over some grey areas in my knowledge in C++: 1) If I have const int SomeConst = 1; in a header file, it is global, and it is included in multiple translations units, but it is unused, I know that it does not take up storage in the
0
8586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8520
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8936
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7603
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6442
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5800
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.