Hi all,
In the file simple.h there is a class declaration as follows
class Sink:public BuferedTransformation
{
protcted:
//data and function members in the class BufferedTransformation
//which are public in BufferedTransformation
}
The comment together with the class is --- // make these functions
protected to help prevent unintentional calls to them
I would like to know what exactily is intended. Is it to restrict the use
of the data and function members in the base class.
If it is so then..........
Actually i have a simple cpp file which tries to do the same. But I am able
to access the functions in protected
area from main() using an object of the derived class.
#include<iostream.h>
class Base
{
public:
int get(int a, int b)
{
return(a+b);
}
};
class der:public Base
{
protected: //this is what i am mentioning about . why is it done
so
Base::get;
};
int main()
{
der obj;
cout<<"result is"<<obj.get(12,13)<<endl; //am able to access the
function which is protected in der class
}
So why is it done so? Or is my interpretation wrong?
Thanks and regards
Ramesh V Nair
This e-Mail may contain proprietary and confidential information and is sent for the
intended recipient(s) only.
If by an addressing or transmission error this mail has been misdirected to you, you
are requested to delete this mail immediately.
You are also hereby notified that any use, any form of reproduction, dissemination,
copying, disclosure, modification,
distribution and/or publication of this e-mail message, contents or its attachment
other than by its intended recipient/s is strictly prohibited.
Visit Us at http://www.polaris.co.in