1

I met a problem about the Bullseye code coverage. It's a tracing ability of the program. The following code is not traced.

class A
{
public:
    virtual void func() = 0;
};

class B
{
public:
    virtual void func()
    {
         std::cout << "Am I traced?" << std::endl;
    }
};

void main()
{
    A *pa = new B;
    pa->func();
}

I guess that Bullseye may not trace pure virtual function. If there are someone who has a knowledge about the program, please give me some advice.

Kyokook Hwang
  • 2,682
  • 21
  • 36

1 Answers1

2

You have 2 errors, in the given program:

void func() = 0;

should be,

virtual void func() = 0;

And,

class *pa = new B;

should be,

class B *pa = new B;  // `class` keyword not needed

Also, note that A and B are not related (no inheritance).

iammilind
  • 68,093
  • 33
  • 169
  • 336