Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
C++ class example program
SUBMITTED BY:
RavishBhatt
DATE:
June 29, 2016, 8:53 a.m.
FORMAT:
C++
SIZE:
577 Bytes
Raw
Download
Tweet
HITS:
580
Go to comments
Report
#include
<iostream>
using
namespace
std
;
class
programming
{
private
:
int
variable
;
public
:
void
input_value
()
{
cout
<<
"In function input_value, Enter an integer
\n
"
;
cin
>>
variable
;
}
void
output_value
()
{
cout
<<
"Variable entered is "
;
cout
<<
variable
<<
"
\n
"
;
}
};
main
()
{
programming
object
;
object
.
input_value
();
object
.
output_value
();
//object.variable; Will produce an error because variable is private
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus