























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























Summative Feedback: Resubmission Feedback:
2. General concepts of OOP - Class: A class is a model, blueprint, or prototype of an object that defines or specifies all of
iv. OOP Scenario
v. Class diagram Figure 1 : CLASS DIAGRAM FOR ENCAPSULATION vi. Snippet Code
public class NumberClass{ private int number = 10 ; } public static void Main (string[] args){ NumberClass num = new NumberClass(); Console.WriteLine(num.number); } Figure 2 : PRIVATE ACCESS MODIFIER
public class NumberClass{ public int number = 10 ; } public static void Main (string[] args){ NumberClass num = new NumberClass(); Console.WriteLine(num.number); } Figure 3 : PUBLIC ACCESS MODIFIER
this.idNum = idNum; this.age = age; } public class RunEncap { public static void main(String args[]) { EncapTest encap = new EncapTest(); encap.name("James"); encap.age( 20 ); encap.idNum("12343ms"); Console.WriteLine("Name : " + encap.name()); Console.WriteLine(" Age : " + encap.age()); } } Figure 6 : ENCAPSULATION EXAMPLE
Figure 7 : EXAMPLE’S RESULT
2. Inheritance i. Inheritance
ii. OOP Scenario
iii. Class Diagram Figure 8 : CLASS DIAGRAM FOR INHERITANCE iv. Snippet Code class Animal { String name; public void eat() { Console.WriteLine("I can eat"); } } class Dog : Animal { public void bark() { Console.WriteLine("Woof”); } }
ii. Overriding method
iii. Overloading method
iv. OOP Scenario
v. Class diagram Figure 11 : CLASS DIAGRAM POLYMORPHISM vi. Snippet Code class Animal { public void animalSound() { Console.WriteLine("The animal makes a sound"); } } class Pig : Animal { public void animalSound() { Console.WriteLine("The pig says: wee wee"); } } class Dog : Animal { public void animalSound() { Console.WriteLine("The dog says: woof woof"); }
ii. Abstract method
iii. Abstract class
iv. Interface
v. OOP Scenario
vi. Class diagram Figure 14 : ABSTRARCTION CLASS DIAGRAM Figure 15 : INTERFACE CLASS DIAGRAM