Top Answer
User Avatar
Wiki User
Answered 2010-07-26 04:37:48

// constructor program to add two number's

// program written by SuNiL kUmAr



class constructor



int a,b;


constructor(int m,int n);

int sum();


constructor::constructor(int m,int n)





int constructor::sum()


int s;


return (s);


int main()


int x,y;


cout<<"enter two number's to add \n";


class constructor k (x,y);

cout<<"sum of two number's is = "<<k.sum();


return (0);


User Avatar

Your Answer

Still Have Questions?

Related Questions

Write a program for Fibonacci series by using copy constructor in c plus plus?

write a program for Fibonacci series by using cunstructer ti initilised the value

What is dynamic constructor in c plus plus?

This constructor is used to allocate the memory to the objects at the run time..

What is the difference between implicit and explicit call of constructor in c plus plus?

An implicit constructor call will always call the default constructor, whereas explicit constructor calls allow to chose the best constructor and passing of arguments into the constructor.

List out differennce between constructor and destructor in c plus plus?

Constructor creates an instance of class, destructor destroys it.

Which key word is used as constructor in c plus plus?

There is no specific keyword for a constructor in C++. Simply define and declare a method of the class with the same name as the class and it will be a constructor. A constructor with no arguments is the default constructor, a constructor with one argument of class type is the copy constructor, and a constructor with one argument of some other type is the conversion constructor. You can provide other overloaded constructors if you want.

How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.

Does the constructor is overloaded or not in c plus plus?

That depends on how you define body of class. If you do not define constructors then compiler will provide default constructor and it is not overloaded. If you create your own constructor you automatically overload default constructor.

Is c plus plus is pure object oriented?

No, Becouse we can write C++ program without class

A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999

Write a program in c plus plus to implement macro processor?

Don't write, it is already written, google for 'cpp'.

Write a C plus plus program to add two complex numbers using overloading a binary operator plus?

class complex { private: double real; double imaginary; public: complex() {...} // constructor, etc. operator+(const&amp; complex a) { // operator plus this-&gt;real += a.real; this-&gt;imaginary += a.imaginary; } }

Write a c plus plus program having four classes a constructor and destructor and a structure note please use more than function in your program?

The following is a program with 4 classes and a structure. Constructors and destructors are generated automatically by the compiler so you really only need them if you need more specialised construction. However, a user-defined constructor and destructor have been declared in class A. You don't give any details on what the program should actually do, so it's up to you to fill in the details. As it stands, this program does nothing useful whatsoever, but it has everything you asked for. #include&lt;iostream&gt; class A{ A() {} //constructor ~A() {} // destructor }; class B : public A {}; class C : protected B{}; class D : private C {}; struct E : public A {}; int main() { A a; B b; C c; D d; E e; }

How does C plus plus program write in Visual studio?

In Visual Studio, a C++ program can write to stdout, if it is a console application. It can also write to a file, to a message box, to the debug window, or to a normal window in response to the WM_PAINT message.

How can you write c plus plus program?

You can write a C++ program using nothing more than notepad, however a C++ editor is easier to work with. However, to execute the program, you will also need a C++ compiler and linker. A C++ integrated development environment (IDE) will provide all the tools you need to get started.

You want to download c plus plus program free?

C++ is a language, not a program. If you are trying to write C++ programs you can download gcc, a free compiler, which will convert your C++ code into executable binary code.

Types of constructor in c plus plus?

Default, Copy, Conversion, Implied (a case of default).

How do I write a C plus plus program for binary search?

Use the standard library binary_search function.

Still have questions?

Previously Viewed
Unanswered Questions
What -1 -4x 2 2x x? Asked By Wiki User
What is one sixth of 18? Asked By Wiki User
What equals 35 in addition? Asked By Wiki User