By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

organising classes in c++?

P: n/a
hello,

How do I organise my classes in c++? At the moment I have something like
this in a .cpp file

class classname { //class definition
private:
//...
public:
//...stuff
char getchar();
}

char classname::classname getchar() {
return anyhing;
}

and then in a separate header file I placed a copy of the class definition -
obviously not the function implementations.

Is that how classes make their interfaces known to other classes so a class
in another file just includes <"classname.h">. Must I have a separate
header file to the main .cpp file in order to create associations? Does the
main .cpp file have to include the class definition here and in the header
file? When you have lots of classes how do most c++ programmers organise
them, just as described or different?

I would be grateful for any comments as I just want to be clear on these
points.

Thanks in advance for your help :)
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
please disregard, got the answer in learn.c++ :)

"Jason Carney" <ja***********@btinternet.com> wrote in message
news:bp**********@sparta.btinternet.com...
hello,

How do I organise my classes in c++? At the moment I have something like
this in a .cpp file

class classname { //class definition
private:
//...
public:
//...stuff
char getchar();
}

char classname::classname getchar() {
return anyhing;
}

and then in a separate header file I placed a copy of the class definition - obviously not the function implementations.

Is that how classes make their interfaces known to other classes so a class in another file just includes <"classname.h">. Must I have a separate
header file to the main .cpp file in order to create associations? Does the main .cpp file have to include the class definition here and in the header
file? When you have lots of classes how do most c++ programmers organise
them, just as described or different?

I would be grateful for any comments as I just want to be clear on these
points.

Thanks in advance for your help :)

Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.