|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Structuring a .NET program.
Maybe this should be in c++ but its vc++.net so ill put it here.
The problem is that it dosen't know what the getData function is. It says AminoAcids is not a class name. As far as i can tell this is the last error...please help ![]() #pragma once #include <string> #include <cstdio> #include <cstdlib> #include <iostream> //include file stream functions #include <fstream> //include string stream functions #include <sstream> namespace cDNAtoProtein01 { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System: ata;using namespace System: rawing;using namespace cDNAtoProtein01; /// <summary> /// Summary for Form1 /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public __gc class Form1 : public System::Windows::Forms::Form { public: Form1(void) { InitializeComponent(); //call InitializeFileReader InitializeFileReader(); } protected: void Dispose(Boolean disposing) { if (disposing && components) { components->Dispose(); } __super: ispose(disposing);} private: System::Windows::Forms::Panel * panel1; private: System::Windows::Forms::Label * conout; private: System::Windows::Forms::Button * eSeaq; private: System::Windows::Forms::TextBox * newout; private: System::Windows::Forms::Label * label1; private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container * components; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { //icstuff } public: //prototype getData void AminoAcids::getData(System::String __gc *pLetter, System::String __gc *pName, System::String __gc *pHp); //aminoacids class __gc class AminoAcids { public: //default constructor //getdata function because i cant use array if i have non default //constructor, i.e. one with arguments void getData(System::String __gc *pLetter, System::String __gc *pName, System::String __gc *pHp) { //use the function to copy values into the object letter = pLetter; name = pName; hp = pHp; } // char (*pgD)(char* pLetter, char* pName) = &getData; //more public stuff, these are not protected System::String __gc *letter; System::String __gc *name; System::String __gc *hp; }; //filereader function bool parseString(System::String __gc *pString, System::String __gc *pLetter, int lasize, System::String __gc *pName, int nsize, System::String __gc *pHp, int hsize) { bool failstate; failstate = false; //to implement arrays in managed c++ //i have to use the array list method using namespace std ; pLetter = pString->Substring(1,1); pName = pString->Substring(2,3); pHp = pString->Substring(5,1); if (pLetter != NULL && pName != NULL && pHp != NULL) { failstate = true; } return failstate; } void InitializeFileReader(void) { using namespace cDNAtoProtein01; //initialize an array of aminoacids AminoAcids *array[] = __gc new AminoAcids*[21]; //filereader code String __gc *szFileName; szFileName = "AminoAcids.txt"; using namespace System::IO; FileStream* fsInput = new FileStream (szFileName, FileMode::Open, FileAccess::Read); StreamReader* pFileStreamThree = NULL; pFileStreamThree = new StreamReader(fsInput); for (int i = 0;i < 21 ![]() { System::String __gc *tBuffer; tBuffer = pFileStreamThree->ReadLine(); using namespace std; if (pFileStreamThree->Peek() >= 0) { Form1::conout->Text = "end of file"; break; } using namespace std ; char inpletter[3]; char inpname[5]; char inphp[3]; using namespace cDNAtoProtein01; bool result = parseString(tBuffer, inpletter, 3, inpname, 5, inphp, 3); if(result == false) { Form1::conout->Text = "error parsing string\n"; continue; } else { String __gc *x = inpletter; String __gc *y = inpname; String __gc *z = inphp; array[i]->getData(x , y , z); i = i + 1; } } } private: System::Void eSeaq_Click(System::Object * sender, System::EventArgs * e) { System::String __gc *cabbage; cabbage = "stoat"; conout->Text = cabbage; } }; } |
|
#2
|
|||
|
|||
|
Well it turns out that i didn't need to prototype getData.
I removed that line and it worked.... |
|
#3
|
|||
|
|||
|
Quote:
lol, I hate when it's something that simple ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > .NET Development > Structuring a .NET program. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|