// Online C++ compiler to run C++ program online
#include <iostream>
class Add{
public:
static Add& getInstance(){
static Add instance; // Thread-safe in C++11 and later
return instance;
}
int add(int a, int b){
return a+b;
}
private:
Add() = default;
~Add() = default;
Add(const Add&) = delete;
Add& operator = (const Add&) = delete;
//✅ Yes: Add(const Add&) is the copy constructor (a special function).
//✅ It takes a parameter of type const Add& (reference to const Add).
//✅ The = delete part disables this copy constructor. It doesn’t delete objects—it just forbids copying.
//delte copy dn move
};
int main() {
// Write C++ code here
Add::getInstance();
int a = Add::add(5,6);
std::cout<<a<<std::endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: