programming 썸네일형 리스트형 MyVector - 떡떡한배열2 ────────────────────────────────── T *base; int usage; int capacity; ────────────────────────────────── + MyVector(int _capa=0, T in=0) + v ~MyVector() + void PushBack(T in) + void Inser(int index, T in) + void Erase(int index) + T &operator[ ](int index) + int Usage() + int Capacity() - void Init Property(); - void ExtendStorage(int _capacity); - void Pushback(int cnt, T in); - void ShiftRight(.. 더보기 떡떡한 배열(?) 배열의 사용예 1. #define MAX_STU 50 Stu base[MAX_STU]; //50명관리 int max_stu; Stu *base; //base = (Stu *)malloc(sizeof(Stu)*max_stu); #define MAX_STU 50 Stu *base[MAX_STU]; //관리하고자 하는 곳에 할당 int max_stu; Stu **base; // base = (Stu **) malloc)sizeof(Stu*)max_stu); 하고 // 관리하고자 하는 곳에 할당함 [동적배열] 확장배열!!!을 만들어보자 template class MyVector { T *base; int capacity; int usage; } public: MyVector(int _capa=0. T in =0.. 더보기 Template(2) template class MyVector { T *base; int usage; int capacity; public: void Foo(); } template void MyVoector::Foo() //헤더파일에 { .... } void main() { MyVector *mv = new myVector(); mv -> Foo(); } ------------------------------------------------- class myVector { int * base; ...... } 더보기 이전 1 ··· 25 26 27 28 29 다음