CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   About UList and List class (http://www.cfd-online.com/Forums/openfoam-solving/60404-about-ulist-list-class.html)

leosding November 7, 2005 01:18

Class UList Declaration: te
 
Class UList Declaration:

template<class>
class UList
{
// Private data

//- Number of elements in UList.
label size_;

//- Vector of values of type T.
T* restrict v_;

...
;

and the Clss List is derived from class UList,like this:

template<class>
class List
:
public UList<t>

its constructor:

// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //

// Construct with length specified
template<class>
List<t>::List(const label s)
:
UList<t>(NULL, s)
{
if (this->size_ < 0)
{
FatalErrorIn("List<t>::List(const label size)")
<<>size_
<< abort(FatalError);


if (this->size_)
{
this->v_ = new T[this->size_];

else
{
this->v_ = 0;
}
}
}

size_ and v_ is from class UList as private data, why can they be used in derived class UList?
would somebody give me some help!

leosding December 2, 2005 00:52

The class List is the friend c
 
The class List is the friend class of UList.
I just find the statement in code.
sigh.


All times are GMT -4. The time now is 05:13.