Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,552 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,593 people online right now. Registration is fast and FREE... Join Now!




Error

 
Reply to this topicStart new topic

Error, left of '.addFlight' must have class/struct/union

riow
21 Nov, 2007 - 02:25 PM
Post #1

New D.I.C Head
*

Joined: 21 Nov, 2007
Posts: 2


My Contributions
hi,

I got "error C2228: left of '.addFlight' must have class/struct/union" for main class when I compile my project in Visual Studio.

Here my main class:

CODE
#ifndef MAIN_C
#define MAIN_C

#include "Flight.h"
#include "ReservationSystem.h"

int main(){
    ReservationSystem res();
    res.addFlight(10,15,12);
return 0;
}

#endif


and ReservationSystem class has addFlight method exactly with three const int parameters.

I need help... what could the problem be?

This post has been edited by riow: 21 Nov, 2007 - 03:07 PM
User is offlineProfile CardPM
+Quote Post

riow
RE: Error
21 Nov, 2007 - 03:29 PM
Post #2

New D.I.C Head
*

Joined: 21 Nov, 2007
Posts: 2


My Contributions
Ok, I solved the problem...
I define my object with parantheses even though the constructor doesnt take any argument.

Therefore,

instead "ReservationSystem res();"
I sohould write "ReservationSystem res;"


User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/7/09 09:50PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month