1

Why it says 'data' identifier not found? Protected members are supposed to be available in child class. Is there a problem in template? I'm new in coding, keep that in mind.

#pragma once
#include <iostream>

template <typename T>
class A
{
public:
    class B
    {
    protected:
        T data;
    };

    class C : public B
    {
        void f()
        {
            std::cout << data;
        }
    };
};
gprincip
  • 41
  • 5

0 Answers0