Welcome to My Blog 👋

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

Nesneye Yönelik Programlama (C++) - Dinamik Nesne



  November 27, 2015    Labels:,,, 

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

Dinamik Nesne


#include <iostream>

using namespace std;
int x=0;
class sinif{
public:
    int x,y,z;
    sinif(int,int);
    void topla();
    void print();
};
sinif::sinif(int a , int b){
    x=a;
    y=b;
    ::x=::x+1;
}
void sinif::topla(){
    z=x+y;
    cout <<"Sayilar toplami= "<<z<<endl;
}
void sinif::print(){
    cout <<::x<<"Kere Cağırılmıştır"<<endl;
}

int main()
{
    sinif nesne1(1,2),nesne2(3,4),nesne4(5,6),nesne(7,8),nesne8(11,23);
    nesne1.topla();
    nesne2.topla();
    nesne4.print();
}



No comments:

Post a Comment