Start Discovering Solved Questions and Your Course Assignments
TextBooks Included
Active Tutors
Asked Questions
Answered Questions
overloading unary operators using friend functionclass signint abcpublicsign signintintint void putdatavoidfriend void operator-sign ampvoid
overloading binary operatorsclass sifloat ipnrapublicsisiint gpint gn int grvoid putdatavoidsi operatorsisi sioperatorsi i1si i2 i2ppi1p i2iii1i
overloading unary operatorsclass signint abcpublicsign signintintint void putdatavoidvoid operator-void signoperator-a-ab-bc-c
rules of operator overloading it is a function defined to an operator with new term or meaning it cannot produce new operator it cannot modified the
destructorthe purpose of destructor is to free the memory when the compiler memory is reduced or not enough to execute certain program sometimes
dynamic initialization of objectsit is initializing the objects by passing the valued to the constructor from the user input orother means
constructors and destructorsa class is defined as constructor by declaring a constructor in the form of function insidethe class in other word a
a class can be defined inside a block or function this type class is known local class there are few points to be observed when producing class
pointer declaration for member functionmethod 1 when class is not declared as pointerm nvoidmpfintintampmsetxy npf1020nsetxy1020 is same as prior
pointer declaration for data member method 1int m px this is known as pointer-to-member declared for class member of apx ampmxthe pointer px is
pointer declaration for classm mm pm class m is declared as pointer pmampmpointer class is assigned to a
pointers to membersin c a pointer is created to locate the address of another variable for faster accessconsider the following example
friendly functiona class can have public members and private members the public member can beused through the class using dot
function returning objectthis program is like to the previous program except the function returns object themain rule to be remembered is the
objects as function argumentsin c program there are several methods to define arguments and in some case even astructure can be approved as an
array of objectsthe objects can be declared just like a structure or even a primary data type array of objects may be required to work with large
static data membersa data member inside the class can construct as static data member there are fewguidelines to be followed when declaring
when a class is defined the compiler will not allocate memorythis is true only for data member not for member function as soon as the member
arrays within a classit is just declaring or constructing a derived type array inside the class it works similarto regular arrayconst int
private member functionsa private member functions can be called by the members of the same class consider the following example class sample
specifying a classas discussed a class is defined to develop an algorithm and bind it together in a core shella class is an abstract data type adt
rules of function inline function created without prototype it reduces the memory and it is used only for small function inline function cannot have
function overloadingfunctions can be defined with same name depending upon the type of argument passedthe function will perform this is known
define constant argumentthe argument can be a constant argument the constant variable cannot be changed inside the function definition
default argumentwhen the argument is missing then the function will read the default value of the missingargument to make use of default argument