P
Phil Sykes
the following three files are my first attempt at creating a class and
instantiating - their names explain what's what - my question is.....
is what i
have done in declarationsheader.h an example of abstraction,
encapsulation, or
data hiding...or none of these ? see below thanks, Phil.
// declarationsheader.h
class myclass // no base classes
{
private:
int var;
public:
int printdata(int var);
}; // no instances
--------------------------------------------------------
// definitionfile.cpp
#include"declarationsheader.h"
#include<iostream>
int myclass:rintdata(int var)
{
return var;
}
--------------------------------------------------------
// main.cpp
#include"declarationsheader.h"
#include<iostream>
int main(int argc, char *argv[])
{
int myvalue;
std::cin >> myvalue;
myclass myinstance;
std::cout << "the value you entered was " <<
myinstance.printdata(myvalue) << std::endl;
std::cin.get();
std::cin.get();
return 0;
}
---------------------------------------------------------
instantiating - their names explain what's what - my question is.....
is what i
have done in declarationsheader.h an example of abstraction,
encapsulation, or
data hiding...or none of these ? see below thanks, Phil.
// declarationsheader.h
class myclass // no base classes
{
private:
int var;
public:
int printdata(int var);
}; // no instances
--------------------------------------------------------
// definitionfile.cpp
#include"declarationsheader.h"
#include<iostream>
int myclass:rintdata(int var)
{
return var;
}
--------------------------------------------------------
// main.cpp
#include"declarationsheader.h"
#include<iostream>
int main(int argc, char *argv[])
{
int myvalue;
std::cin >> myvalue;
myclass myinstance;
std::cout << "the value you entered was " <<
myinstance.printdata(myvalue) << std::endl;
std::cin.get();
std::cin.get();
return 0;
}
---------------------------------------------------------