none
error C2533: 'ClassRoom::{ctor}' :constructors not allowed a return type

    Question

  • I keep getting the same error code.

    My class hierachy is Class ClassRoom inherits from Class Room

    The constructor, and its associated method, for Room is

    Room::Room(int fl, int numb, char build)

    {

    floor = fl;

    number = numb;

    building = build;

    getRoomDetails();

    }

    void Room:: getRoomDetails()

    {

    cout<<"Room numbers must be between 01 and 99" <<endl;

    cout<<"Enter Room Number -> ";

    cin>>number;

    cout<<endl;

    setBuilding();

    cout<<"Floor numbers must be: "<<endl;

    cout<<"0(ground floor), 1(first floor), 2(second floor) or 3(third floor)"<<endl;

    cout<<"Enter Floor Number -> ";

    cin>>floor;

    }

    ******************************************************************************************************************************************************************

    The constructor, and its associated method, for ClassRoom is

    ClassRoom::ClassRoom(int fl, int numb, char build, int cap, char b)

    : Room(fl, numb, build)

    {

    getClassRoomDetails();

    }

    void ClassRoom::getClassRoomDetails()

    {

    Room::getRoomDetails();

    cout<<"Enter the room capacity ->";

    cin>>cap;

    cout<<endl;

    cout<<"Board types avaliable are w(whiteboard), s(whitescreen)";

    cout<<"Enter the board type ->";

    cin>>b;

    cout<<endl;

    }

    *****************************************************************************************************************************************************************

    When I started I only had class Room and everything compiled without any problems, when I've extended the Room class to ClassRoom my problems occur.

    Any help would be appriciated

    Sunday, March 18, 2007 8:00 PM

Answers

  • I've solved my own problem. I forgot the semi colon at the end of my header file for ClassRoom.
    Sunday, March 18, 2007 9:07 PM

All replies

  • I've solved my own problem. I forgot the semi colon at the end of my header file for ClassRoom.
    Sunday, March 18, 2007 9:07 PM
  •  hai!
    Im a new user fo the c++,and l  meet the same problems you  give.
    would you have the answer?
    Tank you!!!
    Saturday, September 27, 2008 10:28 AM
  • imbest:

    Didn't he say he had found the answer? And say what it was?


    David Wilkinson | Visual C++ MVP
    Saturday, September 27, 2008 12:24 PM