Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Call insert function statement (http://www.go4expert.com/forums/insert-function-statement-t6968/)

aquarius2236 22Oct2007 19:16

Call insert function statement
 
Code:

template <class T>
class BasicMinMaxHeap {
public:
void insert(const T& elt);}
--------------------------------------
template <class T>
void BasicMinMaxHeap<T>::insert(const T& elt) {
  if(lastindex == maxsize) grow();

  cerr << "insert: " << elt << endl;

  lastindex++;
  A[lastindex] = elt;
  bubbleUp(lastindex);
}

void main(){

// if i want to call the above insert function, what is the statement look like??    <--------- Question
}


shabbir 22Oct2007 19:21

Re: Call insert function statement
 
You have posted it as an Article under the Article / Source code section. I have moved it to the Queries and Discussion forum.

dharmaraj.guru 24Oct2007 16:23

Re: Call insert function statement
 
Try this out..
Code:

class SomeClass {
};

void main() {
    BasicMinMapHeap<int> integer_heap;
    BasicMinMapHeap<SomeClass> SomeClass_heap;
    SomeClass obj;
 
  integer_heap.insert(3);
  integer_heap(10);
    SomeClass_heap.insert(object);
}

Correct me if I am wrong somewhere..

| Dharma |


All times are GMT +5.5. The time now is 01:51.