You are on page 1of 6

UNIT II

2-Marks
1.What is the Benefits of oop?
1.The principal of data hiding helps the programmer to build secure programs.
2. Through inheritance ,We can eliminate redundant code and extend the use of
existing classes.
3.Object oriented sstem can be easil upgraded from small to large sstem.
!. "oft#are complexing can be easil managed.
2.What is $pplication of oop?
1.%eal time sstems.
2."imulation and modelling.
3.Object Oriented &atabase.
!.$' and expert sstems .
(.)$&*)$+ sstem.
,.-e#ral -et#or.s and parallel programming
3.&efine )lasses?
$ class is a /ser defined data tpe. 't is #a to bind data and functions
together .'t encapsulate data and functions into a single /nit.
Once a class has been defined, #e can create an number of objects belonging to that
class.
!. &efine &ata $bstraction?
$bstraction refers to the act of refers ending essential features
#ithout including the bac.ground details or explanations.
The classes use the concept of data abstraction the are 0no#n as $bstract &ata
Tpes1$&T2.
(. &efine 3ncapsulation4
The #rapping up of data and functions into a single /nit is 0no#n as
encapsulation.
The data is not accessible to the outside #orld, $nd onl those functions #hich are
Wrapped in the class can access it.
These functions pro5ide the interface bet#een the object6s data and the program. This
insulation of the data from direct access b the programs is called data hiding 1or2
information hiding.
,.&efine 'nheritance?
'nheritance is the process b #hich objects of one class ac7uire the
properties of objects of another class.
'n oop the )oncept of inheritance pro5ides the idea of reusabilit.
This means that #e can add additional features to an existing class #ithout modifing it.
This is possible b deri5ing a ne# class #ill ha5e the )ombined features of both the
class.
8 &efine 9olmorphism?
9olmorphism ,a :ree. term, means the abilit to ta.e more than
one form.
$n operation ma exhibit different beha5iours in different instance. This beha5iour
depends upon the tpes of data and number of argument used in the operation.
't has t#o tpes.
;.What is Operator O5erloading?1+a*<une 2=1=2
The process of ma.ing are operator to exhibit different
beha5iours in different instances is 0no#n as operator o5erloading.
>.What is ?unction O5erloading?
The process of ma.ing an operation to exhibit different
beha5iour in different instances is 0no#n as ?unction O5erloading
10.How to Defning member function?
Member functions can de fned in two plaus.
1.In side clans defnition.
2. outside clans defnition.
Outside defnition:
Member functions tat are declased inside of te clans con be
defned separatel! outside of te class.
11.Defne ?riend ?unction?(Nov/Dec 2010)
$ non@member function access to the pri5ate members of a
class b using a friend function.
$ friend function has to access all pri5ate and protected members
of the class.
$ friend function should ha5e its protected #ithin
class,preceeding.it #ith a .e#ord friend
12.What is )haracteristics of a friend function?
1.'t is not in the scope of the class.
2.'t cannot be called using the object of that class.
3.'t can be declared either in the public or the pri5ate part of a clss #ithout affecting its
meaning.
!./sull,it has the objects s arguments
13.What is 'nline ?unction?1-o5*&ec 2=112
$n inline function in a function that is expanded inline #hen it in
in5o.ed.ie2 )ompiler replaces the function call #ith the corresponding function
)ode.
1!.&efine )onstructor?
$ constructor is a special member function.
$ constructor name is same as the class name.The constructor is in5o.ed #hene5er an
object of its associated class is created.
1( What is )haracteristics of constructor?
1.The should be declared in the public section.
2.The are in5o.ed automaticall #hen the objects are created.
3.The do not ha5a return tpe
1,.What is Tpes of )onstructor?
1.&efault )onstructor
2.9aremeteriAed )onstructor.
3. )op )onstructor.
1. &efault )onstructor4
$ )onstructor that accepts no parameter is called the default
constructor 'f no such )onstructor is defind,then the )ompile supplies a default
)onstructor
2. 9arameteriAed )onstructor4
'f the constructor ha5e argument then it is called
paremeteriAed constructor.
When the constructor is parameteriAed,#e must pro5ide appropriate arguments for the
constructor
This cn be done in t#o #as.
1.B calling the constructor explicitl.
2.B clling the constructor implicitl.
&estructor4
$ destructor is used to destro the objects that ha5e been created
B a constructor.
The destructor is member function #hose name is same
$s the class name but it proceeded b tilde.
)op )onstructor4
$ cop constructor ta.es a refers to an object of the same class as
itself as an argument.
$ cop constructor is used to declare and initialiAe an object from another
object $ reference 5ariables has been used as an argument to the cop constructor.
We cannot pass the argument b 5alue to a cop constructor.
18.&efine "tatic members?
$ data member of a class cn be 7ualified as static the properties of a
static.the properties of a static member 5ariables is similer to a Bc6 static 5ariable.
)C$%4
12't is initialiAed to Aero #hen the first object of its class is created,no other initialiAe is
permitted.
22onl one cop of the member is created for the entires class and it is shared b all the
objects of that class, no matter ho# man objects re created.
1;.What is TC'" 9O'-T3%?1+a*<une 2=122
When a member function in called it in automaticall passed an
implicit argument that in a pointer to the in5o.ing object.
'e2The object on #hich the function in called.This pointer is called this pointer

You might also like