Assignment 2 Oop
Assignment 2 Oop
Submitted by:
Hammad Saeed
Submitted to:
Sir Saif Ali
Roll no:
69
Class:
BSCS (B) 6TH SEMESTER
Subject:
Object Oriented Analysis and Design
What is class?
What is an object?
What does the this keyword refer to when used inside a class?
The this keyword refers to the current object in a method or constructor. The most
common use of the this keyword is to eliminate the confusion between class attributes and
parameters with the same name (because a class attribute is shadowed by a method or
constructor parameter). If you omit the keyword in the example above, the output would
be "0" instead of "5".
When static keyword is used, variable or data members or functions cannot be modified
again. It is allocated for the lifetime of program. Static functions can be called directly by
using class name. Static variables are initialized only once. Compiler persist the variable till
the end of the program. Static variable can be defined inside or outside the function. They
are local to the block. The default value of static variable is zero. The static variables are
alive till the execution of the program.
What is inheritance?