C++-Logo.wine
C++

What is dynamic binding in c++? with example

polymorphism is the ability to use an operator or function in different ways. Polymorphism gives different meanings to the operator or functions. Poly, referring to-many, signifies the many use of these operators and functions. A single function usage in many forms or an operator functioning in many ways can be called polymorphism. For example:- #include<iostream.h> […]

C++-Logo.wine
C++

C++ program to overload ‘+’ operator to find the sum of two complex numbers

#include<iostream.h> #include<conio.h> class add { public: inta,b; add(intr,int i) { a=r; b=i; } add() { } add operator +(add); void disp(); }; add add::operator + (add t1) { add t2; t2.a=a+t1.a; t2.b=b+t2.b; return t2; } void add :: disp() { cout<<” \n RESULT=” <<a<<”and”<<b; } void main() { clrscr(); add pix1(12,4); add pix2(82,4); add pix3; […]

C++-Logo.wine
C++

concept of reusability, How it is achieved in C++?

software re-usability is primary attribute of software quality. C++ strongly supports the concept of  reusability. C++ features such as classes, virtual function, and templates allow designs to be expressed so that re-use is made easier there are many advantage of reusability. They can be applied to reduce cost, effort and time of software development. It […]

C++-Logo.wine
C++

what is Virtual Functions? explain with example

Virtual Functions- Virtual function is member function of a class. Virtual function is declared with the keyword virtual. Virtual function takes a different functionality in the derived class. It is used to implement run time polymorphism. For example:- #include<iostream.h> #include<conio.h> Class pixeles { public: virtual void disp() { cout<<“PIXELES CLASSES FOR BCA & MCA” ; […]

C++-Logo.wine
C++

xplain the Destructor in detail with the help of examples, in context of C++ programming.

Destructor :- it is also special member of class having same name but is defined with (tilde) ~ sign. It can be parameterised. It can’t be overloaded. It does not return a value even void. It is called automatically when delete an object. Example:- #include<iostream.h> #include<conio.h> classpix { public: pix() { cout<<“\n This is constructor”; […]

C++-Logo.wine
C++

What is constructor? Define Book class with the basic features of a book. Define the default constructor, parameterised constructor, member functions display_book_details() for displaying the details of book. Use appropriate access control specifies in this program.

What is constructor? Define Book class with the basic features of a book. Define the default constructor, parameterised constructor, member functions display_book_details() fordisplaying the details of book. Use appropriate access control specifies in this program. Constructor Constructor is a special member function of class having same name of class It is called automatically when create […]

C++-Logo.wine
C++

Explain use of any two I/O formatting flags in C++ with example.

C++ defines some format flags for standard input and output, which can be manipulated with the flags, setf, and unsetf functions. For example,  cout.setf(ios_base::left, ios_base::adjustfield);  void stream::unsetf(fmtflags flags); The function unsetf() uses flags to clear the io_stream_format_flags associated with the current stream. #include <iostream.h> main() { ios_base::fmtflags original_flags = cout.flags(); cout<< 812<<‘|’; cout.setf(ios_base::left,ios_base::adjustfield); cout.width(10); cout<< […]