Hi Expert,
This is me again
I am learning Protected and Private member in a base class. Can you show me what is the difference by following code? I tried to access the protected variable proValue in the base class without success!
#include<iostream.h>
#include<stdio.h>
class BaseClass
{
protected:
int proValue;
private:
int priValue;
public:
BaseClass(){proValue = 1; priValue = 2;}
};
class DeriveClass : public BaseClass
{
};
void main()
{
DeriveClass class2;
cout<<class2.proValue()<<endl;
// cout<<class2.priProValue<<endl;
getchar();
}
This is me again
I am learning Protected and Private member in a base class. Can you show me what is the difference by following code? I tried to access the protected variable proValue in the base class without success!
#include<iostream.h>
#include<stdio.h>
class BaseClass
{
protected:
int proValue;
private:
int priValue;
public:
BaseClass(){proValue = 1; priValue = 2;}
};
class DeriveClass : public BaseClass
{
};
void main()
{
DeriveClass class2;
cout<<class2.proValue()<<endl;
// cout<<class2.priProValue<<endl;
getchar();
}