root > Senior Software Engineer | Scala, AWS, Kubernetes, Microservices, Python, Go, PostgreSQL

Technical Blog: Functional Programming, Cloud Architecture & DevOps


  • Home

  • Categories

  • Archives

  • Tags

  • Search

aggretion relationship c++

Posted on 2013-12-23

aggretion relationship c++

```c++ //KURTLAR VADİSİ #include using namespace std;

Read more »

virtual destructor

Posted on 2013-12-23

virtual destructor

```c++ #include using namespace std;

Read more »

no title

Posted on 2013-12-16
Read more »

static counter hmmm =]

Posted on 2013-12-11

static counter hmmm =]

 #include<iostream
 
 using namespace std;
 
 class test
 {
     public:
     test()
     {
         count++;
     }
     ~test()
     {
         count--;
     }
     static int getCount()
     {
         return count;
     }
 
   /*  test& getK(int a)
     {
         k=a;
         return *this;
     }
     */
     private:
     static int count;
    // int k;
 };
 int test::count=0;
 
 int main()
 {
     {
     test *b; // pointer atanır nesne oluşmaz
     test b1,b2;
     b=new test[7]; // nesne oluştu burda
     cout<<test::getCount()<<endl; // count==9
 
     }
     cout<<test::getCount()<<endl; // count==7 kalır eğer delete b
 demez isek.
 
     {
     test *k; // pointer atanır nesne oluşmaz
     test b1,b2;
     k=new test[7]; // nesne oluştu burda
     delete [] k;
     }
     cout<<test::getCount()<<endl; // count==7 hala çünkü burda
 pointerla oluşanları sildik,üstteki count değişmedi
 
     return 0;
 }
Read more »

1.midterm copy constructor belası O_o

Posted on 2013-12-11

1.midterm copy constructor belası O_o

 #include<iostream
 #include<string>
 using namespace std;
 
 class car
 {
     public:
     car():name("mercedes"),model(2013){}
     car(string x,int y)
     {
         name=x;
         model=y;
     }
     car(car & p) //copy constructor
     {
         name=p.name;
         model=p.model;
 
     }
 
     void print()
     {
         cout<<name<<endl;
         cout<<model<<endl;
     }
 
     private:
     string name;
     int model;
 
 };
 
 int main()
 {
     car a("ferrari",2010);
     car b(a);
     car c;
     car d;
 
     a.print();
     b.print();
     c.print();
     d.print();
     return 0;
 }
Read more »

adding two array list with operator+ O_O

Posted on 2013-12-11

adding two array list with operator+ O_O

 /*+ operatoru iki array list i birlestirecek sekilde (ornek:
 lis1+list2 : list2 list1 in sonuna eklenecek) overload ediniz.
  const List List::operator+(const List& input_list){*/
 
  #include<iostream
  using namespace std;
 
  class Liste
  {
 
      public:
      Liste(int = 10);
      Liste(const Liste &);
      Liste& operator+(Liste &);
      int getSize() {return size;}
      private:
      int *ptr;
      int size;
  };
 Liste::Liste(int aSize)
 {
     size=(aSize  0 ? aSize : 10 );
     ptr  = new int[size];
 
     for(int i=0; i<size; i++)
     {
         ptr[i]=0;
     }
 }
 
 Liste::Liste(const Liste &p)
 {
     size=p.size;
 
     ptr = new int[size];
 
     for(int i=0; i<size; i++)
     {
         ptr[i]=p.ptr[i];
     }
 }
 
 Liste& Liste::operator+(Liste &d)
 {
     int i=size;
     size=size+d.size;
 
     Liste *c= new Liste(size);
     Liste& result=*c;
 
     int k=0;
     for(k=0; k<i; k++)
     {
         c-ptr[k]=ptr[k];
     }
     k=0;
     for(i; i<size; i++)
     {
         c-ptr[i]=d.ptr[k];
     }
 
     for(k=0; k<size; k++)
     {
         ptr[k]=c-ptr[k]; //copy to first array c=a+b - a has
 got all the numbers
     }
 
     return result;
 }
 
 
 int main()
 {
     Liste a(5),b(4);
     Liste& c=a+b;
 
     cout<<c.getSize()<<endl;
 
     return 0;
 }
Read more »

decrement & increment

Posted on 2013-12-11

decrement & increment

 //operator++ and operator--
 #include<iostream>
 
 using namespace std;
 
 class decInc
 {
   public:
   decInc(int m=5):k(m) { };
   decInc& operator++();
   decInc operator++(int);
   decInc& operator--();
   decInc operator--(int);
   int getK()
   {
       return k;
   }
 
   private:
   int k;
 
 };
 
 decInc& decInc::operator++() //++K
 {
     k=k+1;
     return *this;
 }
 
 decInc decInc::operator++(int) //K++
 {
     decInc temp=*this;
     k=k+1;
     return temp;
 }
 
 decInc& decInc::operator--() //--K
 {
     k=k-1;
     return *this;
 }
 
 decInc decInc::operator--(int) //K--
 {
     decInc temp=*this;
     k=k-1;
     return temp;
 }
 
 int main()
 {
     int x;
 
     decInc d;
     ++d; // 6
     d++; // still 6;
     x=d.getK(); // x=7 now ;
     cout<<x<<endl;
     --d; // 6
     d--; // 6
     x=d.getK(); //x=5 now ;
     cout<<x<<endl;
 
     return 0;
 }
Read more »

inheritance acccess rules

Posted on 2013-12-10

inheritance acccess rules

```c++ #include

Read more »

Introduction

Posted on 2013-12-08

Introduction

Read more »

detay in the detay

Posted on 2013-12-04

detay in the detay

Read more »
1 … 18 19 20 21
teaddict

teaddict

205 posts
37 categories
645 tags
RSS
GitHub
© 2025 teaddict