Hi,
Teachers stress to students the importance of datas and methods encapsulation in a class. Users should only access only datas and methods that you want them to through your client code.
My question is, suppose I intentionally made a class data members and methods public just for this question. How would one access the functions in the class when its compiled into an exe-file? Example, suppose I wrote a program below. I compiled it into an exe File and gave only the exe file to someone and ask them to find a way to
call the "Function1" function so that it can cout,"hello World!", how can one do that with just the exe-file. Is it possible to do that? Or did I Misunderstand the concept of encapsulation?
class Fun
{
public:
void Function1();
};
void Fun::Function()
{
cout<<"Hello World!";
}
void main()
{
//Blank;
}
Teachers stress to students the importance of datas and methods encapsulation in a class. Users should only access only datas and methods that you want them to through your client code.
My question is, suppose I intentionally made a class data members and methods public just for this question. How would one access the functions in the class when its compiled into an exe-file? Example, suppose I wrote a program below. I compiled it into an exe File and gave only the exe file to someone and ask them to find a way to
call the "Function1" function so that it can cout,"hello World!", how can one do that with just the exe-file. Is it possible to do that? Or did I Misunderstand the concept of encapsulation?
class Fun
{
public:
void Function1();
};
void Fun::Function()
{
cout<<"Hello World!";
}
void main()
{
//Blank;
}