Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > constructor cal...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 43935 of 48044
Post > Topic >>

constructor calling

by asit <lipun4u@[EMAIL PROTECTED] > Mar 16, 2008 at 01:44 AM

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 ??
 




 3 Posts in Topic:
constructor calling
asit <lipun4u@[EMAIL P  2008-03-16 01:44:44 
Re: constructor calling
"Alf P. Steinbach&qu  2008-03-16 09:55:19 
Re: constructor calling
"Ivan Vecerina"  2008-03-16 11:43:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 22:44:56 CDT 2008.