This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C2000 v6.4.9: #332-D...is inaccessible

Guru 20045 points


Hello,

Why is the compiler is giving me

#332-D "CHILD_CLASS1::CHILD_CLASS1()" (declared at line 31) is inaccessible and

#332-D "CHILD_CLASS1::CHILD_CLASS1()" (declared at line 31) is inaccessible  

for the following program.

Stephen

class PARENT_CLASS
{
public:
    PARENT_CLASS(){x=1; y=2;}

    void func1(int r)
    {
        a = 1;
        b = 2;
        c = 6;
        x = r;
        y = 10;
    }

    int a;
    int b;
    int c;

protected:
    int x;
    int y;
};

class CHILD_CLASS1:public PARENT_CLASS
{
#if 1
    CHILD_CLASS1()
    {
       x=99;
       y=200;
    }
#endif
    void func2(int r)
    {
        a = 55;
        b = 11;
        c = r;
        x = 31;
        y = 130;
    }
};

class CHILD_CLASS2:public PARENT_CLASS
{
#if 1
    CHILD_CLASS2()
    {
       x=52;
       y=35;
    }
#endif
    void func2(void)
    {
        a = 55;
        b = 11;
        c = 623;
        x = 31;
        y = 130;
    }
};

CHILD_CLASS1 ChildClass1;
CHILD_CLASS2 ChildClass2;

int main(void)
{
	
    ChildClass1.func1(73);

    ChildClass2.func1(44);
    
return 0; }