Basic program Classes C++.
#include <iostream>
using namespace std;
class a{
public:
void set(int x){num = x;}
int get(){return num;}
private:
int num;
};
int main(){
a b;
b.set(45);
cout << b.get();
return 0;
}
#include <iostream>
using namespace std;
class a{
public:
void set(int x){num = x;}
int get(){return num;}
private:
int num;
};
int main(){
a b;
b.set(45);
cout << b.get();
return 0;
}
No comments:
Post a Comment