Skip to content

Instantly share code, notes, and snippets.

View rudradesai200's full-sized avatar
🎯
Focusing

Rudra Desai rudradesai200

🎯
Focusing
View GitHub Profile
class Dummy {
private:
int X = 0;
const int Y = 1;
public:
//declares method const
int getY() const { return Y;}
//declares return type const
const int getX() { return X; }
//declares return type , method and pointer const
class Dummy {
private:
int X = 0;
public:
//this function will give an error if
//object declared is of constant type
int getX() { return X; }
//this function will work fine as
//we have declared it const.