Archived

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

zip7000

include and class instruction

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
#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