[URGENT] HELP NEEDED FOR CLASS IN C++

Discussion in 'Programmer's Corner' started by NiCeBoY, Jun 3, 2009.

  1. NiCeBoY

    Thread Starter Active Member

    Aug 20, 2008
    59
    0
    hello,
    i got an assignment which consist of 3 questions.
    i was able to do first and second question but the third one i am getting some problems..

    i am posting the code and question as image so as they don't appear on search engines as its for uni things...

    The answer is a .cpp file. I modified the filename to .cpp.txt because the forum here does not allow upload of .cpp file.

    only these part i think needs to modify:

    first:
    second :

    Third

    I really need to get this working urgently...

    Please when replying don't post the whole code directly on the forum...

    send as attachment or just part which you modified...


    Thank you very much in advance for your help...
     
    Last edited: Jun 3, 2009
  2. Mark44

    Well-Known Member

    Nov 26, 2007
    626
    1
    When you say it isn't working, what do you mean? Are you getting compiler or linker errors, or are you getting no errors but your program isn't producing any results or is producing incorrect results?
     
  3. NiCeBoY

    Thread Starter Active Member

    Aug 20, 2008
    59
    0
    i am getting errors,
    here are the errors:

    thanks
     
  4. Mark44

    Well-Known Member

    Nov 26, 2007
    626
    1
    OK, let's take a look at the first five errors (I'm going to skip the warnings for now).
    Every one of these is a compiler error or warning, so the compiler is telling you that you did something wrong for each one. I'm going to omit the first part of the error message.

    1. Line 83 - error C2504: 'TwoD_Shape' : base class undefined
    In your code you have a Two_dim_shape, but you changed this to TwoD_Shape. Change all occurrences of TwoD_Shape to Two_dim_shape.

    2. Line 89 - error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    I think this one will go away after you fix the first error.

    3. Line 90 - error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    Same as previous error.

    4. Line 91 - error C2065: 'centre' : undeclared identifier
    This too will go away once you inherit the Circle class from the correct base class, Two_dim_shape.
    5. Line 92 - error C2065: 'size' : undeclared identifier
    Same as above.

    Make those changes, and recompile. You should get a lot fewer errrors after you fix the problem of TwoD_Shape declared vs. Two_dim_shape used.

    Mark
     
Loading...