MOHH
Apr 4th, 2002, 08:53 PM
hello,
having some difficulty here :( with contructors... What i'de like to do is initialize the multidimensional array with all the morse code values..
i can initialize the array in source file ok, but when i try to initialize the same array in a class it won't work...
I'm farily new to classes and contructors, so any explanation on what could be wrong would be great!!
//#include <string.h>
#include <stdlib.h>
#define MORSE = 6;
#define ALPHA = 37;
class morse
{
private:
/*char morseCode[][MORSE] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",
".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",
".--","-..-","-.--","--..",".----","..---","...--","....-",".....",
"-....","--...","---..","----.","-----"};
*/
char morseCode[][MORSE];
char alpha[37];
public:
// char getCode(char alpha);
morse();
};
morse::morse()
{
morseCode[][MORSE] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",
".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",
".--","-..-","-.--","--..",".----","..---","...--","....-",".....",
"-....","--...","---..","----.","-----"};
}
thanks in advance for any help!
having some difficulty here :( with contructors... What i'de like to do is initialize the multidimensional array with all the morse code values..
i can initialize the array in source file ok, but when i try to initialize the same array in a class it won't work...
I'm farily new to classes and contructors, so any explanation on what could be wrong would be great!!
//#include <string.h>
#include <stdlib.h>
#define MORSE = 6;
#define ALPHA = 37;
class morse
{
private:
/*char morseCode[][MORSE] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",
".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",
".--","-..-","-.--","--..",".----","..---","...--","....-",".....",
"-....","--...","---..","----.","-----"};
*/
char morseCode[][MORSE];
char alpha[37];
public:
// char getCode(char alpha);
morse();
};
morse::morse()
{
morseCode[][MORSE] = {".-","-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",
".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",
".--","-..-","-.--","--..",".----","..---","...--","....-",".....",
"-....","--...","---..","----.","-----"};
}
thanks in advance for any help!