Monday, January 31, 2011

C++ Constructor Concept

/*
 * Devices.cpp
 *
 *  Created on: Jan 27, 2011
 *      Author: Karthikeyan.D
 */

#include "Devices.h"

Devices::Devices() {
    // TODO Auto-generated constructor stub
cout<<"Hello World1"<<endl;

}

Devices::~Devices() {

    // TODO Auto-generated destructor stub
    cout<<"Hello World2"<<endl;
}


int main()
{
    Devices Obj;
    Obj.chair();


return 0;
}
---------------------------------------------------------------------------------------------------------
/*
 * Devices.h
 *
 *  Created on: Jan 27, 2011
 *      Author: Karthikeyan.D
 */

#ifndef DEVICES_H_
#define DEVICES_H_
# include
class Devices {
public:
    //int Chair();
    int chair()
    {
        cout << "This method is used to understand the Object creation in the C++ "<<endl;
        return 0;
    }
    Devices();
    virtual ~Devices();

};

#endif /* DEVICES_H_ */



________________________________________________________________________________

OUTPUT:









Hello World1
This method is used to understand the Object creation in the C++
Hello World2

No comments:

Post a Comment