A
asit
Can i call constructor and destructor using object name and dot
operator ??
#include <iostream>
using namespace std;
class my_cls
{
int a;
public:
my_cls()
{
a=100;
cout<<"Constructor called"<<endl;
}
~my_cls()
{
cout<<"Destructor called"<<endl;
}
void put_data()
{
cout<<a<<endl;
}
};
int main()
{
my_cls a;
a.my_cls::my_cls();
return 0;
}
Is the above program legal ??
operator ??
#include <iostream>
using namespace std;
class my_cls
{
int a;
public:
my_cls()
{
a=100;
cout<<"Constructor called"<<endl;
}
~my_cls()
{
cout<<"Destructor called"<<endl;
}
void put_data()
{
cout<<a<<endl;
}
};
int main()
{
my_cls a;
a.my_cls::my_cls();
return 0;
}
Is the above program legal ??