Modül 14 - Constructor ve Destructor

this Pointer ile Constructor

C++ Programlama Eğitimi · 1 görev

# this Pointer

Constructor parametreleri ile üye değişkenlerin isimleri aynı olduğunda this pointer kullanılır.

this pointer mevcut nesneyi temsil eder.

Bu kullanım profesyonel projelerde standart hale gelmiştir.

Örnek Kod
#include <iostream>
#include <string>
using namespace std;

class Student
{
public:
    string ad;

    Student(string ad)
    {
        this->ad = ad;
    }
};

🎯 Bu Dersteki Görevler

this Kullanımı

Dil: cpp

Yükleniyor…