Skip to main content

Constructors in c++

                                                    Constructors
In c++ provides a special member function called the constructor.which enable the object to inilaze when it is created.It is a special function its name is the same as class name.
The constructor function is invoked whenever an object of its associated class is created.It is called constructor because it construct the values of data members of the class.In constructor that accepts no parameter is called the default constructor.If no such constructor is define than the compiler supplies a default constructor.The constructor that accept parameters as a argument is called parameterized constructor.
Characterstatices :-
Ø     Constructors should be decleare in the public section.constructor are invoke automatically when the objects are created.They do not have return types, not even void therefore a constructor cannot return values.
Ø     Constructor can not be inherited,but a drived class can call the base class constructor.
Ø     Like c++ function a constructor can have default arguments.
Ø     Constructors cannot be virtural
Ø     It cannot refer the address of a contructor.
Ø     An object with a constructor or distructor cannot be news as a member of union.

Ø     A constructor make implicit calls to the operators new and delete.when memory allocation/deallocation is required.

Comments

Popular posts from this blog

Pointer in c language

                                                          Pointer A pointer is a drivided class.It is built from one of the fundamental data type available in c.Pointer contain memory addresses as their values.since these memory addresses are the locations in the computer memory where program instructions and data are stored.Pointer can be used to access and manuplates data store in the memory. Pointer decleartion :- A=[10] Where a is variable name. 10 is the value of variable. Adderss of variable(suppose) 65524. *p – pointer symbol Pointer program :- #include<stdio.h> #include<conio.h> Void main() { Int a ; Int *p ; Printf(“enter a no”); Scanf(“%d”,&a); P=&a; Printf(“\n value of variable %d=”,a); Printf(“\n value of variable %d=”,*p); Printf(“\n addres of variable %u=”,&a); ...

Array in c

                                                              ARRAY An array is a fixed size scequence collection of element of the same data type.It is simply a grouping of like type data.In its simplest form,an array be used to represent a list of number or a list of names.An array is a collection of similar data type elements.some examples where the concept of an array can be used. List of temperatures records every hour in a day,or a month, or a year. List of employee in an organization. List of products and their post sold by a store. Test score of a class of student. List of consumers and their telephones number and etc. Since an array provide a convent structure for represent data, it is classified as one of the data structure in C.
Entrepreneurship opportunities: - There are many ways in which a person might exercise his or her entrepreneurial skills. The three main types of businessman opportunities include franchises, developing new operations within an existing organization, and forming a completely new one. Businessman opportunities can mean anything from working on small projects or the development of massive new enterprises. It is possible to find businessman opportunities within an already established organization. People who do so are sometimes called entrepreneurs, or inside businessmen. An entrepreneur takes initiative to identify and develop projects that help an organization meet its objectives or grow in new directions. Corporate social businessman opportunities relate specifically to leading projects that enhance a company's performance in terms of social development and responsibility. Many companies today encourage different kinds of entrepreneurship across all of their departm...