C++ Örnekleri 71 – Fonksiyonlara Nesne Atamak

#include <iostream>
#include <conio.h>
using namespace std;

class deneme{
      int a,b;
      public:
             void ata(int x,int y){
                  a=x;
                  b=y;
                  }
             void goster(){
                  cout << a << " " << b << endl;
                  }
}ob1,ob2;

main(){
       ob1.ata(30,40);
       ob2=ob1;

       ob1.goster();
       ob2.goster();

       getch();
       return 0;
       }

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir