this Pointer ile Constructor
# 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…