0

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]

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by Spiderpig085
0

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.

Edited by mitrmkar: assignments

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.