| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:面向对象技术In Reply To:面向对象技术 Posted by:charmant at 2005-10-28 23:02:39 没有封装性啊 应该尽量用private的!
这个是我的代码~嘿嘿
#include<iostream>
using namespace std;
class Object_Oriented
{
private:
int sum;
int a;
int b;
public:
void input()
{
cin>>a>>b;
}
void plus()
{
sum=a+b;
}
void output()
{
cout<<sum<<endl;
}
}object;
int main()
{
object.input();
object.plus();
object.output();
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator