organising classes in c++?



 DEVELOP > c-Plus-Plus > organising classes in c++?

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Jason Carney"
Date: 19 Nov 2003 01:42:35 PM
Object: organising classes in c++?
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 :)
.

User: "Jason"

Title: Re: organising classes in c++? 19 Nov 2003 04:59:52 PM
please disregard, got the answer in learn.c++ :)
"Jason Carney" <jason.carney1@btinternet.com> wrote in message
news:bpgh3b$p12$1@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 :)


.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER