1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Call insert function statement

Discussion in 'C' started by aquarius2236, Oct 22, 2007.

  1. aquarius2236

    aquarius2236 New Member

    Joined:
    Oct 22, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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
    }
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,285
    Likes Received:
    364
    Trophy Points:
    83
  3. dharmaraj.guru

    dharmaraj.guru New Member

    Joined:
    Oct 23, 2007
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    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 |
     

Share This Page