Object oriented properties
Object oriented Properties
There are types of OOPS
- Inheritance
- Constructor
- Function overloading
- Class Security
- Error handling (exceptions)
- Polymorphism
- Inheritance
Inheritance only use Multiple classes
Types of classes in Inheritance
1.Base class
2.Derive class
- Rules of Inheritance
1.Inheritance cannot count main class
2.Only last class object create .
syntax
Derive class: base class
- Single Inheritance
- Multiple Inheritance
classB display():A
classC parameter():B
classD view():C
- Inheritance with parameter
{
public void show (int a)
{
C.W(a);
}
}
- Function Overloading
Function name is similar but activities are different is called function overloading.
- C# maths function
1.Max function
All math function stored in math library.
syntax : consolewriteline(math. max(value))
- C# string handling function
- C# Bullion Expression
Bullion return two value :
1) True-(1)
2) False-(0)
eg. C.W(10>5);
C.W(10==20);
C.W(10>=10);
- Break statement
Break is always use in looping statement.
Break is keywords.
- Constructor
Constructor is a object initialization process.
1.Variable with value called Initialization.
2.Variable without value called declaration.
- Rules for Constructor
1.Class name and methods name are similar.
eg. class My
{
Public My()
{
}
}
2.Constructor not use void statement.
3.Constructor not use dot operator (m1.show)
- Class security
1. Class cannot access in main body with object.
2. Abstract class is to be create using abstract keyword.
NOTE: Abstract class cannot create object
Abstract class only inherit.
- Exception handling
Exception handling is used to display logical error on computer screen
eg. a=10
b=0
c=a/b;
error message (No. divisible by 0)
- Exception Handling Statement is a communication between exception Library to program
- Exception Handling Statement
1) Try-catch
2) finally
- Array
Array is a collection of similar type data element
☆ Array Separator []
NOTE: Square Bracket is called Array Separator.
[value]--> size
a[5]
Q.How to create array
Syntax: int[] name =new int[size]
int[] a=new int[5]
Comments
Post a Comment