Hello everyone!
I'm trying to understand the following code:

class char_queue 
{
protected:
    struct charNode
    {
    public:
        char val;
        charNode* next;
        charNode(char ch, charList* ptr)
        {
            val = ch; next = ptr;
        }
    };
protected:
    charNode* begin;
    charNode* end;
    void clearCharNode();
public:
    char_queue();
    bool find(char ch);
    virtual void add(char ch);
    virtual void clear()=0;
    virtual void print();
}

Can you explain what does this expression: "virtual void clear()=0;" mean? I know what is "virtual" for? buf void clear()= 0 is very strange for me. 0 must be a returned of function clear()???

Recommended Answers

All 2 Replies

See your other post. It indicates a pure virtual function, which automatically designates your class as abstract.

Thank you very much! You really helped me!

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.