![]() |
| | #1 | |
| Registered User Join Date: Oct 2008
Posts: 53
| My coding idea about inheritance for phones ![]() so i would like to share here about the errors and others. any help is appreciated... now my uml diagram i want to transfer to handwritten coding.so.. Quote:
here's my work...any comments ideas or something..i think it's ok.. Code: class Handphone
{
private:
string phoneNumber;
string message;
double credit;
string inbox[N*];
int object_counter;
public:
Handphone ( string no, double cr,double rate)
void smsEdit();
void smsRead();
}
Class Smartphone : public Handphone
{
private:
image mms_message;
image mms_inbox[N];
public:
void operator>>(Smartphone &s);
void mmsRead();
void mmsEdit();
}
can anyone explain what is string[N*] inbox; and image[N] mms_inbox; what is the data type like?? why does it have a bracket?like[*] and [] the initial i suppose it's a pointer thing. Last edited by MyRedz; 10-22-2009 at 11:34 AM. Reason: correction of errors | |
| MyRedz is offline | |
| | #2 |
| l'Anziano Join Date: Aug 2001
Posts: 2,630
| Well I assume it's a declaration of an array, but it's all wrong. In fact, there's a pretty blatant mix of Java/C#/C++ in this code. The way that those classes and arrays are declared is more of the Java/C# way of doing things. This code won't compile in any of the 3 languages. Last edited by DavidP; 10-22-2009 at 08:09 AM. |
| DavidP is offline | |
| | #3 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,861
| Why do you think string[N*] inbox means anything at all? |
| tabstop is online now | |
| | #4 |
| Registered User Join Date: Oct 2009 Location: While(1)
Posts: 368
| i think in your code which is not pasted you will be having N as #define N with some value and thats why image[N] mms_inbox will become an array of image |
| RockyMarrone is offline | |
| | #5 | |
| Registered User Join Date: Oct 2008
Posts: 53
| wow...no wonder even myself can't do the uml diagram to code properly.. it is a mix of 3 languages... so your ideas... how to make it compilable in the end?this is sure tricky but i just have to try it! is my brief coding part from uml ok? string[N*] inbox means it is a declaration of inbox size if i am not wrong in a array of N pointer is it? well for N is just the box size in here Quote:
for inbox:string[N*] mms_inbox:image[N] where can i learn more about mirror image?it isn't found in c++.. | |
| MyRedz is offline | |
| | #6 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,861
| So that means you need to pick a language. I don't think any of us particularly care which language you pick, so you should pick the one you're most comfortable with. The * doesn't seem to be meaningful from the language sense; the description makes it sound as though it is a parameter, as opposed to a member variable or something, so perhaps whoever wrote your UML is using * in that way. Why do you want to know something about mirror image? |
| tabstop is online now | |
| | #7 |
| Registered User Join Date: Oct 2008
Posts: 53
| ok..* is clear a bit to me..thanks... mirror image is something new to me. can you show some examples.. well the language i choose is c++.. so my initial coding from uml is it correct? |
| MyRedz is offline | |
| | #8 | |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,861
| Quote:
In that case, no, as your array declarations should follow C++ rules instead. Also, C++ does not allow spaces in variable names (so no "object counter"). You didn't include all the items in your original list in your code. (The "void" in front of your operator>> confused me at first, but that's what your original diagram said so I guess that's okay.) | |
| tabstop is online now | |
| | #9 |
| Registered User Join Date: Oct 2008
Posts: 53
| ok.i corrected it.. string inbox[N*]; int object_counter; image mms_inbox[N]; so this are the faults is it? is this ok?i want to proceed to making the descriptions for each class |
| MyRedz is offline | |
| | #10 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,861
| So string inbox[N*] still doesn't make any sense. If you want an array of N strings, then just do that. (I suppose it's possible you want an array of pointers-to-strings, but it seems unlikely to me somehow.) |
| tabstop is online now | |
| | #11 | |
| Registered User Join Date: Oct 2008
Posts: 53
| well i know it's unlikely but then in the uml it says inbox:string[N*] and it's usage is N*: inbox size (i.e., the number of sms that can be stored, e.g. 10).. well it's usage is for the main purpose of the project that is. inheritance from handphone to smartphone which means from text message to picture message or mms ones. can i proceed to the descriptions? Quote:
| |
| MyRedz is offline | |
| | #12 | |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,861
| Quote:
being defined for what you have to work. You can start anywhere you like. | |
| tabstop is online now | |
| | #13 |
| Guest Join Date: Aug 2001
Posts: 5,034
| |
| Sebastiani is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| C++ coding idea | Bnorman | C++ Programming | 15 | 10-22-2009 09:14 AM |
| An idea that's out of my reach of knowledge | Akkernight | Tech Board | 12 | 04-08-2009 09:35 PM |
| The chicken and the egg problem... trying to learn coding but having trouble starting | mothergoose729 | Tech Board | 9 | 03-20-2009 05:22 PM |
| Before Coding | cyberCLoWn | C++ Programming | 16 | 12-15-2003 02:26 AM |
| Inheritance vs Composition | Panopticon | C++ Programming | 11 | 01-20-2003 04:41 AM |