#include <cstdlib>
#include <iostream>
using namespace std;
class A
{
public :
virtual void Nama(string nm) = 0;
virtual void NIM(int nim) = 0;
};
class B : public A
{
public :
void Nama(string nm)
{
cout << "Nama Mahasiswa = "<<nm << endl;
}
void NIM(int nim)
{
cout << "NIM = "<<nim << endl;
}
};
int main(int argc, char *argv[])
{
B b;
b.Nama("Joko Prasetyo");
b.NIM(1113101102);
system("PAUSE");
return EXIT_SUCCESS;
}
Encapsulation in c++
ReplyDeleteReal life example of encapsulation in C++
Nice post, keep sharing