Welcome to My Blog 👋

Java, Spring Framework, Microservices, Docker, Kubernetes, AWS and Others 🚀
Follow Me

Nesneye Yönelik Programlama (C++) - Arkadaş Fonksiyonlar



  November 11, 2015    Labels:,,, 

Çanakkale Onsekiz Mart Üniversitesi Bilgisayar Mühendisliği Bölümü nesneye yönelik programlama (C++) ders notlarım.

Arkadaş Fonksiyonlar


#include <iostream>

using namespace std;

class sinif{
public:
    friend class sinif2;
    int x,y;
    int alan();
    sinif();
};
sinif::sinif(){
    x=3;
    y=4;
}
int sinif::alan(){
    return x*y;
}
class sinif2{
public:
    int z,w;
    int hesapla(sinif a);
    sinif2();
};
sinif2::sinif2(){
    z=1;
    w=2;
}
int sinif2::hesapla(sinif a){
    cout<<a.alan();
}

int main()
{
    sinif2 nesne2;
    sinif nesne;
    nesne2.hesapla(nesne);
}



No comments:

Post a Comment