Hmmm... I'm trying to call a class and it doesn't work and i get this error
/home/XXXX/Desktop/language/main.cpp|13|error: expected constructor, destructor, or type conversion before ‘.’ token|

The syntax is:

print.base="print";

this simple method call returns an error.

Am i really doing something wrong, seeing as i've already looked in my book and they said i had it right.

What's wrong- i have no idea!!

If base is a method call it would have to look something like print.base("print"); You can't set a method equal to a string like that (only a member variable named base), and you need the () when calling a method. If this still doesn't solve the problem, post the class definition for cmd.

ok, base isn't a method, and I'm smart enough to know that!

so, here's the definition:

class cmd
{
string base;
char extension[80];
};

yes, that's really all there is, it's just a way for me to organize the commands.

I'm smart enough to know that!

Wasn't insinuating anything less, lol. It was just that you had said

this simple method call

Are you including the header file or whatnot for class cmd in the file in which you have placed the first two code snippets?

ok, base isn't a method, and I'm smart enough to know that!

so, here's the definition:

class cmd
{
string base;
char extension[80];
};

yes, that's really all there is, it's just a way for me to organize the commands.

Wooah don't get sassy or nobody will help you. You need to declare the member variables as public if you are going to access them directly (Instead of using getter, setter methods).

Comments
Yes, I totally flew past that

o! thanks sooooo much!

wow, i've had that problem and just work around it until i realize the same thing for something else! thanks again

This question has already been answered. Start a new discussion instead.