#include <iostream>
class workers{
private:
char worker_name[20], worker_surname[20];
int worker_age;
public:
void worker_info(char const *w_name, char const *w_surname, int w_age){
for(int i=0;i<20;i++){
worker_name[i] = w_name[i];
worker_surname[i] = w_surname[i];
}
worker_age = w_age;
}
void worker_print(){
std::cout << worker_name << std::endl;
std::cout << worker_surname << std::endl;
std::cout << worker_age << std::endl;
}
};
int main(){
workers ali, arda, cihan;
ali.worker_info("Ali","Bidost",20);
arda.worker_info("Arda","Bidost",20);
cihan.worker_info("Cihan","Bidost",20);
ali.worker_print();
std::cout << std::endl;
arda.worker_print();
std::cout << std::endl;
cihan.worker_print();
return 0;
}
20 Ekim 2016 Perşembe
C++ Sınıflar ve Nesneler [Örnek 1]
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder