As all we know, in order to remove cyclic includes in C++ we seperate
the declarations and definitions of classs and it's member in two files
Header (*.h) and source files (*.cpp). This is not a problem for C# as
there is no concept of include.
I faced problems for seperating declarations and definitions for class
when it contains [default]properties. This can also be done in context
of struct/structures. Here is how we can.
Class A
--------------------------------------
FILE : A.h <-- contains only declarations
--------------------------------------
namespace Ankit
{
public class A
{
private:
int mapData;
public:
property int Height ; // no need for definitions in
A.cpp
property int Width ; // no need for definitions in
A.cpp
property ArrayList^ Points
{
ArrayList^ get();
}
property double Zoom
{
double get();
void set(double level);
}
property int default[int]
{
int get(int index);
}
A();
void Load(double level);
}
}
--------------------------------------
FILE : A.cpp <-- contains implementaions
--------------------------------------
Note:- No need to write access specifiers again
namespace Ankit
{
ArrayList ^ A::Points::get()
{
return this->wayPoints ; // your
implementations
}
double A::Zoom::get() // get set functions should be
written
seperate
{
return 1.0;
}
void A::Zoom::set(double l)
{
;
}
int A::default::get(int index)
{
// your implementations
return this->wayPoints[index];
}
///<summary>
///Default Constructor
///</summary>
A::A()
{
// your implementations
}
void A::Load(double level)
{
//implementations
}
}
}
That's all.
Hope this may be usefull to u....
Regards.....
Ankit Jain
[Developers Have Their Own Gods]
Peter Oliphant - 25 Oct 2005 22:43 GMT
There is also the "#pragma once" command to insure the same include file
isn't referenced more than once if it happens to be in, say, two different
includes being used at the same time (which happens all the time)... : )
[==P==]
> As all we know, in order to remove cyclic includes in C++ we seperate
> the declarations and definitions of classs and it's member in two files
[quoted text clipped - 96 lines]
> Ankit Jain
> [Developers Have Their Own Gods]