hi everyone,
i'm having trouble initializing a private int in a class and can't figure out what's wrong. it's especially confusing me because i do nothing different with my int called size from with my int called HeapSize, but size won't compile. the error i get is: "error: invalid use of member (did you forget the '&'?).
from my .h file:
#ifndef _pqheap_h
#define _pqheap_h
#include "genlib.h"
class PQueue {
public:
PQueue();
~PQueue();
private:
int HeapSize;
int *heap;
int size;
void swap(int p1, int p2);
};
#endif
from my .cpp file:
#include "genlib.h"
#include <iostream>
#include "pqheap.h"
#include "simpio.h"
PQueue::PQueue()
{
size = 0; // error occurs here
HeapSize = 10; // but not here
heap = new int[HeapSize];
}