This document discusses key concepts in object-oriented programming (OOP) such as classes, objects, inheritance, polymorphism, abstraction, and interfaces. It defines classes as blueprints for objects, and objects as specific instances of classes. Inheritance allows classes to inherit attributes and behaviors from other classes to promote code reuse. Polymorphism enables different classes to implement the same methods in different ways. Abstraction hides unnecessary details and focuses on important aspects. Interfaces contain abstract methods but no implementation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
12 views2 pages
Reviewer in Oop
This document discusses key concepts in object-oriented programming (OOP) such as classes, objects, inheritance, polymorphism, abstraction, and interfaces. It defines classes as blueprints for objects, and objects as specific instances of classes. Inheritance allows classes to inherit attributes and behaviors from other classes to promote code reuse. Polymorphism enables different classes to implement the same methods in different ways. Abstraction hides unnecessary details and focuses on important aspects. Interfaces contain abstract methods but no implementation.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
REVIEWER IN OOP Is an OOP technique used to hide data from
OOP- Object Oriented Programming direct access.
Easily to debug because it easily determines the Binding code and data together into a single wrong code in your program. unit. Procedural Programming- dire-diretso ang code Faster and easier to execute INHERITANCE Kailangan alamin yung pagkakasunod ng code- PROCEDURAL Principle in OOP CLASS- blue print/general Ex: School Provides a feature called reusability of code. In OBJECT- specific Ex: name of School inheritance we reuse the code. class Car { BASE CLASS- exits w/c is sounds as parent class and string color = “pink”; a class called kids class w/c is inherited/derived from static void Main (string [] args) { the base/parent class. Car honda = new Car (); class name BASE CLASS & DRIVED CLASS - Is a relationship (baby is a person) class name object name creating new object class Person { Console.WriteLine (honda.color); public string speak(){ BASE CLASS } Console.WriteLine (“I am talking”); } } CLASS & MAIN CLASS class Car { class baby: Person { (DERIVED CLASS) string color= “pink”; 1. SINGLE INHERITANCE double price= 1,000,000.75; - there is only 1 base class & 1 derived class. static void Main (string[]args){ Inherits from a single class Car honda= new Car(); CLASS 4 Car Toyota=new Car(); Console.WriteLine(“Color of Honda:” + honda.color); Single derived class Console.WriteLine(“Color of Toyota:” + toyota.color); CLASS B }} 2. MULTI-LEVEL INHERITANCE - This derived class may have inherited from the class Car { base class/ another derived class. public string color= “pink”; Base class public double price= 1,000,000.75; - Access modifier CLASS A } Derived class (Main Class) CLASS B class Vroomvroom { static void Main (string[]args){ Derived class Car honda= new Car(); CLASS C Car Toyota=new Car(); 3. HIERARCHICAL INHERITANCE honda.color = “violet”; - Modify - Multiple derived class inherits from a single Console.WriteLine(“Color of Honda:” + honda.color); class. Console.WriteLine(“Color of Toyota:” + CLASS A toyota.color); }} OBJECT- instance of a class CLASS C CLASS- collection of objects CLASS B VOID- walang ire-return na variable 4. MULTIPLE INHERITANCE ACCESS MODIFIER- used to modify where the - 1 derived class, more based class class, variables, and methods accessible. PUBLIC- access to any classes CLASS A CLASS B PRIVATE- access inside its own class PROTECTED- accessible in the same class/ in class CLASS C that is inherited from the class. 5. HYBRID INHERITANCE INTERNAL- accessible within its own assembly. - Combination of 2 / more types of inheritance. Access using object CLASS A Class member- fields & methods MULTILEVEL
ATTRIBUTES- used to represent an object by using a CLASS B
dot, like: anObject.some Attribute HIERARCHICAL CLASS C CLASS D METHODS- used to represent the working of an object like: anObject.some Method(parameters) PRIVATE- it will not be access to another MUTATOR- to set values Bakit tayo gumagamit ng access modifier? MAIN PROGRAM- input data from users -Used for security for our data. CONSTRUCTOR- use to call methods like setName, setAddress, Public Base Class like: this.name=Name PROPERTIES & ENCAPSULATION setName(name)-Constructor ACCESSOR METHOD- get Console.Write (“Meow”); INHERITANCE- class Passenger: User { (pwedeng gawan ng Object) PROTECTEDGENERATE ID()- hindi access ni main class Program { but maaaccess ni passenger static void Main (string[]args) { ABSTRACTION Cat myCat = new Cat(); works w/ accessor & mutator method my Cat.animal sound (); non-abstract methods on abstract class inherit/create derived class hides certain details abstract class uses “abstract” keyword serves as a base class blue print constructor/destructor abstract class does not have object inherit using colon (:) Ex: class Cat: Animal{ abstract methods if you will create an abstract method the parameter is empty Ex: public abstract void sound (); the method will be access if it is inherited Non-abstract method Ex: public void walk () { Console.Write (“walking”) POLYMORPHISM fundamental concept in OOP that enables object of different classes to be treated as instances of a common superclass or interface. if 1 task is performed by different ways occurring in more than 1 form METHOD OVERLOADING- occurs when a class defines multiple methods with the same name but different parameters. COMPILE TIME/ STATIC POLYMORPHISM- allows to create consistent code. METHOD OVERLOADING-we can create methods w/ the same name in a class if they have different numbers of parameter and types of parameters. OPERATOR OVERLOADING- operator is overloaded to perform numeric addition as well s string concatenation. RUN-TIME/ DYNAMIC POLYMORPHISM- the method that is called is determined at te run-time not a compile time. For OVERRIDING METHOD OVERRIDING- occurs when a subclass defines a method that already exists in its superclass. VIRTUAL- allows the method to be overridden by the derived class. OVERRIDE- indicates the method is overriding the method from the base class. INTERFACES no fields methods & other members are abstract & public. no object no usage of override keyword do not have a body completely “abstract class” cannot contain a constructor interface Animal return type- void animal sound (); abstract void run (); method must be inherited by using (:) Ex: class Cat: Animal { Public void animal sound () – modify