Thursday, July 22, 2010

What is C++ Constructor, and How to use Constructor with Inheritance

,
A constructor is a special type of function whose functionality is to intialize the data members of a class at a time of object creation.so that it is also called automatic intialization of objects. Properties of a constructor:-1.)It is invoked automatically at a time of the creation of object.so that the data members are intialized. 2.)It has neither return type nor void type. 3.)The name of a constructor and class should be identical. 4.)It should be declared on a public section. Types of aconstructor:- 1.)Default Constructor.2.)Copy Constructor.3.)Parametrised construc...
Read more →

Thursday, July 8, 2010

Use of Friend Function

,
Friend Function is a very nice feature of C++. You know that when we write a programme in c ++ we also use class. We also define members of classes which are accessible or not. In this post we'll discuss what is friend function, what the use of friend function, and how to use of friend function. 1. What is friend function What function is ordinary function and another feature of C++. Which is very useful when we use Private or Public classes both. 2. What the use of friend function Some Time we write programme in C++ and declare some member private and some public but in case we another class...
Read more →

Wednesday, July 7, 2010

what is object in c++

,
In C++ be are Write many because it's object oriented programming language (OOPS). But Many beginner student of C++ confuse what is Object and how to use. In this post we'll discuss about Object of C++ and, What is Object, How to use. What is Object.Objects are the basic runtime entities in any system.Objects are behave as a container which contains the properties of a class.How to useFor Example:-Student is a class and the student1 is the object of class student.class student{char name[50];void display();};student student1; //object created of class studentstudent1 contain the name and...
Read more →

Friday, July 2, 2010

Example of If Else Statement in C

,
If else statement is very useful in any programming language.  An if statement may also optionally contain a second statement, the “else" clause which is to be executed if the condition is not met. Here is an example: if(n > 0) { average = sum / n; else { printf("can't compute average\n"); average = 0; } The general syntax of an if statement in c: if ( expression ) statement(s) else statement(s) This feature is based in our daily life many...
Read more →

What is Loop in C++

,
Loop is a block code which is very useful in C or Cplusplus Programming. In real life many times we need some work in a repeated way. C and Cplusplus also provide this feature in programming we can easy to create loop which is help to your program when you need some repeat work. Loops are 2 types 1. Entry Control Loop. 2.)Exit Control Loop. Q. if we need print a name in 10 times then we have 2 option first is write the printf command in 10 times and second is use loop In C # Include # include main() { int i; char name[]={"abcd"}; for (i=1;i<=10;i++) { printf("%s",name); } in C++ #...
Read more →