• Advertisement

Archived

This topic is now archived and is closed to further replies.

include and class instruction

This topic is 5637 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, I''m a little bit confused! what are the difference between : #include <A.h> and class a; Is the first instruction can always replace the second one and vice versa?

Share this post


Link to post
Share on other sites
Advertisement
#include"A.h"

here you include the header file (which maybe holds the class)

class a;

here you declare a class, what you need to fill like this

class a{
int x
a();
~a();
};


.....a header file is just another file filled with sourcecode.....often used to declare variables, functions, or classes.....

[edited by - pipo declown on August 15, 2002 7:52:18 AM]

Share this post


Link to post
Share on other sites
class A; can also be a forward reference for purposes of using A in the declaration of another class:

class A; // structure declared somewhere else
class B
{
void func(A* a); // used in this definition
};

Share this post


Link to post
Share on other sites

  • Advertisement