how to use Pure virtual methods ?

I'm working on an example and it's using a pure virutal method in one of the classes.
So basically there's two classes, and the third one I'm trying to make a pure virutal method. So I added virtual class 1 function(); to the bottom of my third class, and I made all the members static.


So it mentions I have to override it with subclasses, and provide concrete classes. I am a bit confused with the terminology, am I meant to simply implement a bunch of static functions, and what exactly is concrete classes that inherit from the class I'm making, which are meant to implement the static methods?
This should help.

1
2
3
4
5
6
7
8
9
10
11
12
13
class A
{
    public:
    A();
    virtual void function() = 0; // pure virutal
};

class B : public A
{
    public:
    B();
    void function(); // pure virtual function must be implemented
};
Thanks for the help. I'm talking more in terms of something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
typedef shared_ptr<test> test;
class A
{
    public:
    A();
};

class B 
{
    public:
    static test...
    static test...(all static)
    virtual void function() = 0; // pure virutal
};


I have to implement the static pointers
Last edited on
Topic archived. No new replies allowed.