A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

Access the address of an object using \'this\' pointer in C++
Q:

Access the address of an object using \'this\' pointer in C++

0

Access the address of an object using 'this' pointer in C++

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Example:

#include <iostream>
using namespace std;

class ExampleThis
{
	public:
		ExampleThis* address(void){
			return this;
		}
};

//Main functionn
int main ()
{
	//creating objects
	ExampleThis Ex1, Ex2, Ex3;

	//printing the object's address 
	cout<<"Address of object Ex1: "<<Ex1.address ()<<endl;
	cout<<"Address of object Ex2: "<<Ex2.address ()<<endl;
	cout<<"Address of object Ex3: "<<Ex3.address ()<<endl;

	return 0;
}

Output

Address of object Ex1: 0x7ffd6550aa8d
Address of object Ex2: 0x7ffd6550aa8e
Address of object Ex3: 0x7ffd6550aa8f

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now