joeGrammar
Programmer
Interesting Tidbit I discovered:
I have 2 files, one which has a class declaration and another which creates a class object, the object then tried to use a protected member and it cannot.
example:
header file:
#include <iostream.h>
class Protected
{
protected:
int printer(){ cout << "hey!!"; }
}
main.cpp
#include <iostream.h>
#include "protect.h"
int main()
{
Protected* p;
p->printer();
}
Why won't this work?
I have 2 files, one which has a class declaration and another which creates a class object, the object then tried to use a protected member and it cannot.
example:
header file:
#include <iostream.h>
class Protected
{
protected:
int printer(){ cout << "hey!!"; }
}
main.cpp
#include <iostream.h>
#include "protect.h"
int main()
{
Protected* p;
p->printer();
}
Why won't this work?