Hey guys, just wonderin why I am getting a compiler error on this code... I've had this error before and spent ages tryin to fix it.... But i can tfor the life of me remember... Thanks to all who reply...:)

class Date
{
    public:
    Date();
    private:
};
class Time
{
    public:
    Time();
    private:
};
class Product
{
    public:
    Product();
    private:
};
int main()
{
    Collectable* collected[4];
    collected[0] = new Date();
    collected[1] = new Time();
    collected[2] = new Product();
    collected[3] = new Date();
    return 1;
}

[TEX]
Error:
error: `collected' was not declared in this scope
error: `Collectable' was not declared in this scope
[/TEX]

There is no mention of what a Collectable represents.
Then it looks like your classes need to be inheriting from Collectable in order for the allocations/assignments to work.

Would it help if i made a collectable class?

Would it help if i made a collectable class?

Errm, I think you need to figure out what you want to achieve - from the ground up.
If you are practising inheritance/pointers - perhaps find some basic tutorials.

OK thanks for your help mitrmkar..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.