Inheritance in C++

Composition:- A Composition is similar as an inheritance. A Composition means writing an object of some another class inside some another class. This gives a same effect as an inheritance but there are some functional differences in an inheritance and a composition. e.g. class demo { public: int i; void fun() { cout<<”inside the fun of a demo class.” } }; class hello { public: int x; demo d; void gun() { cout<<”inside the gun of a hello class.”; } }; int main() { demo d1; hello d2;;; return 0; }…Read more

File I/O Solution in C

This is a full  file I/O  solution where user enters some information on the terminal and this user input is then stored into the file. Also this is a structured file operation program which supports : 1) Insertion of a record 2) Deletion of a record 3) Updation of a record 4) Searching of a record Note: This program assumes that user enters the data in the correct specified format and order as required for further processing. i.e. Where the input is number and user enters a character , the program will go…Read more

Local, Nested Class and ‘this’ pointer in C++

Local Class:-   • If a class is defined inside any function then that class is called as local class. • This local class is used only inside a particular function. • We can not create an object of this local class outside that function. • According to above point local class works same as a local variable inside a function. e.g. class hello { void fun() { class demo { public: int i; }; demo d; d.i=10; } // function ends. }; • In an above example, demo class is considered as…Read more

Constructors, Destructors and Inline Function in C++

Constructors:- Constructor is a user defined function whose name is same as the class name. Constructor is called as a user defined function, because, a programmer can provide its own constructor with its own functionality. Constructor is a first function which is called implicitly in the objects lifetime. In the constructor , memory is not allocated for the object but constructor is responsible for following things, 1)    It is responsible for initializing memory allocated for that object. 2)    Constructor is responsible for setting appropriate environment for a class. 3)    If our class contains…Read more

Function Overloading (C++)

Function Overloading:-   Function overloading is compile time polymorphism. Appropriate function call is resolved at compile time only. This means writing a function with a same name but with the different definations. There are some rules to write a n overloaded functions. Functions are overloaded on to the basis of number of parameters and type of parameters. C++ compilers differentiate the overloaded function by using naming decoration or name mangling. We can also overload constructor but not destructor. We can not overload a function depend on its return type value because at the…Read more

Constant concepts (C++) with Examples

Constant concepts C++:- Constant is a data type qualifier which provide extra quality to our normal variable and that quality is :- After initializing a constant vairable with appropriate value which we can not change that initialized value. In C and C++, rules about constant variable is that we have to initialize that constant variable at the time of declaration of that variable. We can not initialize the variable after declaring it.   const int I; i=10; // Error   In this case, if the variable I is the local variable then at…Read more

Mobile Device Management

At the starting this proposition work called COMMONS that was to discover the regular portable framework for versatility answer for the Bus of ABB. The 37 cross stage advances were explored to check whether they have the capacity to improve a portable system that can run on distinctive unit stages, for example ipad, Android apparatuses and Windows Phone. There are numerous profits furnished by cross-stage instruments (CPT): low incremental expenses and large amounts of code reuse, brief time-to-market, expanded generally application quality. Utilizing Cpts let the designers address numerous stages. The designers in…Read more

Classes in C++

Class:- Class is a collection of a characteristics and a behaviors. Characteristics means data members defined in the class and behaviors means a member functions/methods which are defined in the class and this methods are applied on to the characteristics of the class. e.g. class demo { public: int i,j; void fun() { cout<<”Inside the fun of demo”; cout<<i; cout<<j; } }; In the above example, demo is our class which contains two characteristics as I and j. and both are integers. Behaviors of the demo class is a function fun() which applied…Read more

Pure Virtual Function & Abstract Base Class

If we want to provide only interface for the derived class then we use the concept of abstract base class. If we create abstract base class then we can not create object of that base class. Writing pure virtual function means writing (=0) at the end of a prototype of a function without any defination. When we write at least a single pure virtual function inside the class then that class is considered as a abstract base class. A class having pure virtual function only says what to do does not say how…Read more

Reference Variables in C++

This concept is used in C++. When we create a variable of any data type, we use single identifier to identify that variable. Example:    int i; In this case, i is an identifier from which we can access that variable. If we want to assign some another name to that same identifier then we can use the reference variable concept from C++. A reference variable are such a variable which are refering to already created datatypes. A reference variables are the names given to the variable. Entry of that another name is…Read more