Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / how call a pointer to a class without including its .h file ?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. how call a pointer to a class without including its .h file ?
#3205
Posted by: 2004-01-07 02:29:51
hello,
how call a pointer to a class without including its .h file ?
1-
//file CC.h--------------------------------------------------

#pagma once

#include <windows.h>

#include "one.h" //  class "one"
#include "two.h" //  class "two"

class CC
{
private:
one *p_one; // pointeur sur classe one
two *p_two; // pointeur sur classe two

public:
one *Getone(){return p_one;};
two *Gettwo (){return p_two;};
//other fonctions
};

CC *p_CC; // pointer to class CC

//fichier CC.cpp---------------------------------------------
//d¨?finitions of fonctions

2- 2?? file :
// ff.h------------------------------------------------------

#pagma once
#include <windows.h>

extern class CC *p_CC;

class ff
{
//d¨?clarations
};

//ff.cpp-------------------------------------
i use the pointer p_CC  to have access to the private members of classes  one  and  two.
but i do not include their .h , neither the one of CC class..

all these files belong to one poject..

thank you for your help..
-------------------------------
c++, visual net c++
Message2. Re: how call a pointer to a class without including its .h file ?
#3206
Posted by: 2004-01-07 14:56:55
first of all, it's "pragma once"
Second use:

class one;
class two;

To include a forwared declaration to a class...
Also try google-ing for "c++ friend reference guide"

Happy searching
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-12-13  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0