CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

About UList and List class

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   November 7, 2005, 01:18
Default Class UList Declaration: te
  #1
Member
 
Leosding
Join Date: Mar 2009
Posts: 51
Rep Power: 8
leosding is on a distinguished road
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 is offline   Reply With Quote

Old   December 2, 2005, 00:52
Default The class List is the friend c
  #2
Member
 
Leosding
Join Date: Mar 2009
Posts: 51
Rep Power: 8
leosding is on a distinguished road
The class List is the friend class of UList.
I just find the statement in code.
sigh.
leosding is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tmp class maka OpenFOAM Bugs 2 August 20, 2008 14:53
How to add a new class locally ville OpenFOAM 4 December 11, 2006 14:20
Class Project Tiger Main CFD Forum 5 March 13, 2006 16:58
CFD class notes Lee Main CFD Forum 0 January 30, 2004 13:39


All times are GMT -4. The time now is 21:24.