Programming Tools

where students meet to knowledge

Category

C++

What is polymorphism? Explain function overloading with suitable example.

Polymorphism The word Polymorphism means having many forms. Polymorphism means the ability to take many forms. For instance, an operator may exhibit different behavior in different situations. In oop, polymorphism  plays an important role in allowing objects having different internal… Continue Reading →

What does inheritance means in C++?How can we make private member inheritance without modifying?

Inheritance The process of deriving a new class from an old one is called inheritance. The old class is referred to as the Base class and the new class is called the Derived Class. The Derived class may inherit some… Continue Reading →

Using friend function to find the larger of two number which belong to different classes

#include<iostream> using namespace std; class B; class A { int a; public: void input(); friend void larger(A,B); }; class B { int b; public: void input(); friend void larger(A,B); }; void A::input() { cout<<“Enter a number : “; cin>>a; }… Continue Reading →

Add two complex number using operator overloading

#include<iostream> using namespace std; class Complex { int x,y; public: Complex(){} Complex(int real,int imag) { x=real; y=imag; } Complex operator+(Complex); void display(); }; Complex Complex::operator+(Complex) { Complex tmp,c; tmp.x=x+c.x; tmp.y=c.y; return tmp; } void Complex::display() { cout<<x<<showpos<<y<<“i”; } int main()… Continue Reading →

To Implement unary operator(-) using operator overloading

#include<iostream> using namespace std; class space { int x,y,z; public: void input(int a,int b,int c); void display(); void operator-(); }; void space::input(int a,int b,int c) { x=a;y=b;z=c; } void space::display() { cout<<“x=”<<x<<“\n”<<“y=”<<y<<“\n”<<“z=”<<z<<“\n”; } void space::operator-() { x=-x;y=-y;z=-z; } int main()… Continue Reading →

A special member function called Constructor whose basic task is to create objects of its class but they are mostly used for the Purpose of Object Initialization. Every class has at least one constructor. A class is a special type of… Continue Reading →

Class

The ‘Class’ The class is a way to bind the data and functions together. It allows the data and functions to be hidden. If necessary from direct access by outside functions. When creating a class a new abstract data type… Continue Reading →

Functions

A function is a group of statements that together perform a task. Every C++ program has at least one function, which is main(), and all the most trivial programs can define additional functions. You can divide up your code into… Continue Reading →

Data Structures

C/C++ arrays allow you to define variables that combine several data items of the same kind but structure is another user defined data type which allows you to combine data items of different kinds. Structures are used to represent a… Continue Reading →

C++ tutorial videos

Functions

Function Prototyping (Declaration)                                                                          … Continue Reading →

OPERATORS IN C++

C++ supports all of the operators of ‘C’ languages and aditionaly the following- 1    : :       Scope resolution Operator 2    : :*    pointer – to – member decelerator .*       pointer – to –… Continue Reading →

© 2017 Programming Tools — acadinetech.com