473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Object Array Class

1
Hi all.
I kindly want your help here.

As a newbie in OOP, I am trying to understand how the language reacts.

What I want to do is initialize an object array of another class.

What I am trying to say is :

Class xx
Expand|Select|Wrap|Line Numbers
  1. foo[] foox = new foo[9] 
  2. foox[0] = new foo("value here","value here");
  3.  
  4. //Class foo has the variables . IE string name; - string something;
After a 5hour search and total confusion,the only way this works is this :
Expand|Select|Wrap|Line Numbers
  1. foo[] foox;
  2.  
  3. public xx()
  4. {
  5.   foox = new foo[9];
  6.   foox[0] = new foo("value","value");
  7.   foox[1] = new foo(etc etc);
  8.  
  9. //etc 
  10.  
  11. }
Is this the only way ? And how can I print the objects when I need them in my Main class ?? Thank you in advance.
May 30 '12 #1
0 1014

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: surrealtrauma | last post by:
i have a trouble about that: i want to ask user to enter the employee data (employee no., name, worked hour, etc.), but i dont know how to sort the data related to a particular employee as a...
7
by: Brian P | last post by:
I am getting an invalid cast exception when I try to take an ArrayList with datetime values and use the ToArray method to create an object array. I need to use an object array becase I'm working...
38
by: VK | last post by:
Hello, In my object I have getDirectory() method which returns 2-dimentional array (or an imitation of 2-dimentional array using two JavaScript objects with auto-handled length property - please...
2
by: Zac | last post by:
Alright anyone who has 2c throw it in... I am working through a custom xml serializer and have come upon a conundrum, given our class design. The interface implemented on the base class (base...
4
by: kin | last post by:
After a I read Walkthrough: Connecting to Data in Objects (http://msdn2.microsoft.com/en-us/library/ms171892.aspx#Mtps_DropDownFilterText). I still have project on that. My School project...
3
by: Nayan Mansinha | last post by:
Hi All How can I store an array of objects in my C# Application.Settings? I have CMyObject class for which an array is created: CMyObject arr = new CMyObject; arr = new CMyObject();...
2
by: Big Charles | last post by:
Hello, I would like to create an array-class to be able to call like: Dim oMyCar as New MyCar ' After initializing oMyCar, the object has to be like: oMyCar(0).Brand...
2
by: Jean Marie | last post by:
Hi, i have a problem with the usage of stdClass. From a SOAP based web service i get a code list as an array of stdClass instances: array ( 0 => stdClass::__set_state(array(
6
by: Patient Guy | last post by:
I am a newcomer to using PHP but not to programming (C, C++, Javascript). I am playing around with classes and wanted to make a function that has a method simply for producing either plain text...
1
by: Talat Maqsood | last post by:
Hello dears i am having this error can any one guide me? <?php define('DIR_LANGUAGE', ' C:\wamp\www\mvc\mvc/'); final class Language { private $directory; private $data = array();
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.