Access between classes to retrieve elements of a StringArray Programming Software Development by Son of a gun … try to basically access an element from the StringArray in a seperate class from the UI it advises…15 to 17s","116" };// The StringArray can be used with the UI class sortedList model =… jfrm.setVisible(true); } }[/CODE] And finally my StringArray class code (I have not added the code for the… Re: Access between classes to retrieve elements of a StringArray Programming Software Development by Son of a gun … code that then goes onto access the elements of the StringArray I am getting lost with. [CODE]// instance version - how to… Re: Access between classes to retrieve elements of a StringArray Programming Software Development by JamesCherrill Your public variable is an instance variable, so you need an instance of StringArrays to access it OR you can make it static and access it via the class name, ie [CODE]// instance version - how to reference StringArrays sa = new StringArrays(); ... sa.Anglia; // static version - how to reference StringArrays.Anglia;[/CODE] Either way you … Re: Access between classes to retrieve elements of a StringArray Programming Software Development by JamesCherrill [CODE]// instance version - how to reference StringArrays sa = new StringArrays(); for (i=0; i<sa.Anglia.length; i++) System.out.println(sa.Anglia[i]); OR String[] localRefToArrayInOtherlass = new StringArrays().Anglia; for (i=0; i<localRefToArrayInOtherlass .length; i++) System.out.println(localRefToArrayInOtherlass[i]);[/… Re: Access between classes to retrieve elements of a StringArray Programming Software Development by Son of a gun Thank you again for the response but this is the approach I had thought was correct and had already followed. This, even using your code snippet, errors as it does not recognize the variable Anglia. I'm clearly doing this wrong but I cannot see why at the moment. Ian [QUOTE=JamesCherrill;1382787] [CODE]// instance version - how to … Re: Access between classes to retrieve elements of a StringArray Programming Software Development by JamesCherrill This is going to be some silly typo thing, so Can you post the most recent def of the StringArrays class and the full compiler error message with the exact line it's referring to? Re: Access between classes to retrieve elements of a StringArray Programming Software Development by Son of a gun [QUOTE=JamesCherrill;1382863]This is going to be some silly typo thing, so Can you post the most recent def of the StringArrays class and the full compiler error message with the exact line it's referring to?[/QUOTE] James I know your right it will be a dumb error on my part, thank you for looking at this. in the UI code i have updated it to … Re: Access between classes to retrieve elements of a StringArray Programming Software Development by JamesCherrill You changed public String Anglia[]; to StringArrays Anglia = new StringArrays(); While that's not necessarily a bad thing to do, it does invalidate all the code that assumed Anglia was an array of Strings. And, the declaration of a new Anglia variable in the constructor is still a major error - its scope is limited to the constructor and it is … Re: Access between classes to retrieve elements of a StringArray Programming Software Development by Son of a gun [QUOTE=JamesCherrill;1382898] Thank you James, if you stick your head outside you may hear the sound of a penny dropping in Berkshire! I re arranged the code layout and variable declaration for StringArrays as you hinted at and it now works as I had hoped. Best wishes Ian Container class problem Programming Software Development by icelantic stringArray::operator == (const stringArray &right); bool stringArray::operator!=(const stringArray &right) const; stringArray stringArray::operator +=(const stringArray &right); friend stringArray operator+(const stringArray& left, const stringArray Re: Container class problem Programming Software Development by mrnutty stringArray& left, const stringArray& left);` 1) Does not need to be a friend. 2) Need to implement the assignment operator. stringArray::stringArray…(const stringArray& source) { count = source.count; for(int i = 0… Re: Container class problem Programming Software Development by icelantic … #include <iostream> #include <cstdlib> #include "stringArray.h" using namespace std; using namespace csci2270_assignmentTwo; int main…( ) { stringArray names; cout << "Number of strings in names … Re: Container class problem Programming Software Development by StuXYZ … short string class to do that for you, and make stringArray a storage for for a number of string objects. I… Pascal - student search program Programming Software Development by shreka … := (High-Low) div 2 + Low; if StringArray[Mid] = StudentID then begin Result := Mid; Goto… Break end else if StringArray[Mid] > StudentID then High := Mid else… Malloc memory scope & memory leaking Programming Software Development by ShortYute stringArray[j]); } free(stringArray); } /* Allocate room for numOfArrays */ stringArray = malloc(numOfArrays * sizeof *stringArray); /* If allocation succeeded */ if (stringArray…i < numOfArrays; i++) { /* Allocate */ stringArray[i] = malloc( (sizeOfEachArray) + 1); }… How to rewrite this code Programming Software Development by SCMAN2010 … 80 void sort(char **a, int n); char *stringArray[N]; int main(int argc, char *argv[]) { …(" "); fgets(stringArray[i],MAX_STRLEN,stdin); *strchr(stringArray[i],'\n') = '\0'; } sort(stringArray,N); printf("\nSorted:\n… (i = 0; i < N; i++) { puts(stringArray[i]); free(stringArray[i]); } return 0; } /* selection sort */ void sort… Errors in My Template Program Programming Software Development by sciprog1 …:\n"; intArray.outputArray(); Array< string, 7 > stringArray; // create stringArray // initialize stringArray with user input values cout << "\nEnter… " << stringArray.getSize() << " one-word string values:\n"… converting words to phonetic spelling Programming Software Development by _dragonwolf_ …;); if(userInput.equalsIgnoreCase("a")) { stringArray.toString(); System.out.println("Alpha"); …} if(userInput.equalsIgnoreCase("b")) { stringArray.toString(); System.out.println("Bravo"); }… Re: Ambiguous Overloads For Literals & Deleting duplicates in vectors Programming Software Development by mike_2000_17 … do it. If you have a constructor like this: class StringArray { // ... StringArray(const char* str); }; Then, that constructor is considered a… allow only explicit conversions using that constructor, as in: class StringArray { //... explicit StringArray(const char* str); }; With that, things like the … array stack infix and postfix Programming Software Development by nicolek808 …end of file { element = myScanner.next(); stringArray[ count ] = element; //stores the … expression = " + stringArray[i] ); String postFixExpression = infixToPostfix(stringArray[i]); System.out.println("… array stack infix and postfix Programming Software Development by nicolek808 …end of file { element = myScanner.next(); stringArray[ count ] = element; //stores the … expression = " + stringArray[i] ); String postFixExpression = infixToPostfix(stringArray[i]); System.out.println("… Re: converting words to phonetic spelling Programming Software Development by javaAddict This is totally unnecessary: [CODE] [B][COLOR="Red"]stringArray.toString();[/COLOR][/B] System.out.println("Alpha"); [/CODE] … switch: [CODE] for(int i = 0; i < stringArray.length; i++) { char ch = stringArray[i]; switch (ch) { case 'a': case 'A': System… Re: array stack infix and postfix Programming Software Development by nicolek808 …end of file { element = myScanner.next(); stringArray[ count ] = element; //stores the element… expression = " + stringArray[i] ); String postFixExpression = infixToPostfix(stringArray[i]); System.out.println("… displaying an image from input file Programming Software Development by johnlop1 … String[0]); String testOne = stringArray[0]; String testTwo = stringArray[2]; String testThree = stringArray[4]; String testFour = stringArray[6]; String testFive = stringArray[8]; //System.out.println… Re: How to rewrite this code Programming Software Development by Ancient Dragon [icode]char stringArray[N][MAX_STRLEN];[/icode] Re: How to rewrite this code Programming Software Development by SCMAN2010 [QUOTE=Ancient Dragon;1179485][icode]char stringArray[N][MAX_STRLEN];[/icode][/QUOTE] Thank u for your reply the program now crashes Re: converting words to phonetic spelling Programming Software Development by javaAddict … to write entire code with if statements: [CODE] char ch = stringArray[i]; int index = // convert ch into an int and normalize… Derivatives Programming Software Development by pateldeep454 … the beginning of the main method, called "stringArray" with a length of 26 to hold the…of input from "altitude.txt" with this syntax: stringArray[i] = b.readLine( ); and then, in another loop… syntax like the following: doubleArray[i] = Double.parseDouble(stringArray[i]); Then, in another loop, plot the altitude data… Google map api shows nothing on screen Programming Web Development by accra … var x; for (x = 0; x < stringArray.length; x = x + 1) { var addressDetails … []; var marker; //Separate each field addressDetails = stringArray[x].split("&&&"); //Load the… How to fetch gps values form mysql into Google Map Programming Web Development by accra … var x; for (x = 0; x < stringArray.length; x = x + 1) { var addressDetails … []; var marker; //Separate each field addressDetails = stringArray[x].split("&&&"); //Load the…