C++Primer wrote:
I wanna define a datatype in C++
I wanna read better english in this newsgroup. prolly not gonna hap'n
in C itz like:
typedef struct CELL{
int key;
struct CELL *next;
}cell;
In C++ it's like this:
struct cell {
int key;
cell* next;
};
typedef struct NODE{
int bla,bla....;
struct CELL *il,*il_next;
...
}
struct NODE { // or, maybe, the lowercase: node
int bla, blah;
cell *it, *il_next;
...
};
and some other typedef concerning with CELL
Anyone can tell me how to define em in C++ with templeate?
template <class CELL>
class SH{
private:
CELL....
public:
NoDE? ect???
}
Have you tried a book? You know, not _any_ book, of course, a C++
book. You should, you know... Stroustrup's "TC++PL", chapter 16,
deals with standard library design and has great examples of creating
your own containers using templates. I bet other books do too.
V