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<< […]

C++-Logo.wine
C C++

What is Object Oriented Programming (OOP) paradigm? Explain basic concepts OOP.

Object-oriented programming (oop) is a programming paradigm that represents the concept of “object” that have data fields (attributes that describe the object) and associated procedures known as methods. An object can be considered a “thing” that can perform a set of related activities. The set of activities that the object performs defines the object’s behaviour. […]