OOP Method Patterns (OOP မှာ အသုံးများတဲ့ method ပုံစံများ)

B3.1, B3.2: Common method patterns for constructing and tracing OOP programs in exam contexts.
မြန်မာလို: စာမေးပွဲ မေးခွန်းတွေမှာ OOP (object တွေကို အခြေခံပြီး program ရေးနည်း) program တွေကို ကိုယ်တိုင် တည်ဆောက်ဖို့နဲ့ trace (တစ်ဆင့်ချင်း လိုက်ပြီး မှတ်) လုပ်ဖို့ အသုံးများတဲ့ method ပုံစံများ။

ဒီစာမျက်နှာမှာ “စာမေးပွဲ” ဆိုတာ IB Computer Science (နိုင်ငံတကာ ကျောင်းတွေမှာ သင်တဲ့ ကွန်ပျူတာသိပ္ပံ သင်ရိုး) ရဲ့ စာမေးပွဲကို ဆိုလိုပါတယ်။ အဲဒီ စာမေးပွဲရဲ့ Paper 2 (IB Computer Science စာမေးပွဲမှာ programming မေးခွန်းတွေ ပါတဲ့ စာစောင်) မှာ class (object တွေ ဖန်တီးဖို့ ပုံစံခွက်) တစ်ခုအတွက် method (သီးခြား အလုပ်တစ်ခု လုပ်ပေးတဲ့ code အပိုင်း) တွေကို ကိုယ်တိုင် ရေးခိုင်းတဲ့၊ trace လုပ်ခိုင်းတဲ့ မေးခွန်းတွေ ပါပါတယ်။ IB သင်တန်း မတက်တဲ့ သူတွေအတွက်လည်း class တစ်ခုမှာ method ရေးတဲ့အခါ ဒီ ပုံစံတွေ အသုံးဝင်ပါတယ်။


အကျဉ်းချုပ်

Class တစ်ခုအတွက် ရေးရတဲ့ method အများစုက ပုံစံ အနည်းငယ်ကို လိုက်ပါတယ်: ရေတွက်တာ၊ စုစုပေါင်း တွက်တာ၊ ရှာတာ၊ အကြီးဆုံးကို ရှာတာ စသည်ဖြင့်ပါ။ Class ရဲ့ သတ်မှတ်ချက်တွေ ပြောင်းပေမယ့် method အမျိုးအစား တွေကတော့ အများအားဖြင့် တူတူပါပဲ။ ပုံစံကို မှတ်မိရင် method ကို မြန်မြန်နဲ့ ယုံကြည်မှုရှိရှိ ရေးနိုင်ပါတယ်။

ဒီစာမျက်နှာက အသုံးအများဆုံး ပုံစံတွေကို စုစည်းပြထားပါတယ်၊ တစ်ခုစီမှာ template (ဖြည့်သုံးရမယ့် ပုံစံ code) တစ်ခုနဲ့ Student class တစ်ခုတည်းကို သုံးထားတဲ့ ဥပမာ တစ်ခု ပါပါတယ်။


Student Class (စာမျက်နှာ တစ်ခုလုံးမှာ သုံးပါတယ်)

ဒီစာမျက်နှာက ဥပမာ အားလုံးက ဒီ class ကို သုံးပါတယ်:

public class Student {
    private String name;
    private int grade;
    private String house;

    public Student(String name, int grade, String house) {
        this.name = name;
        this.grade = grade;
        this.house = house;
    }

    public String getName() { return name; }
    public int getGrade() { return grade; }
    public String getHouse() { return house; }

    public void setGrade(int grade) { this.grade = grade; }
}
class Student():
    def __init__(self, name, grade, house):
        self._name = name      # single _ marks the attribute as private
        self._grade = grade
        self._house = house

    def get_name(self):
        return self._name

    def get_grade(self):
        return self._grade

    def get_house(self):
        return self._house

    def set_grade(self, grade):
        self._grade = grade

ပြီးတော့ ကျောင်းသားတွေရဲ့ array (အရွယ်အစား ပုံသေ၊ အမျိုးအစားတူ ဒေတာစု) တစ်ခုကို စီမံတဲ့ ဒီ collection class (object အများကို စုသိမ်းထားတဲ့ class) ကိုလည်း သုံးပါတယ်:

public class School {
    private Student[] students;
    private int count;

    public School(int maxSize) {
        students = new Student[maxSize];
        count = 0;
    }

    public void addStudent(Student s) {
        if (count < students.length) {
            students[count] = s;
            count++;
        }
    }

    public int getCount() { return count; }
    // ... methods below go here
}
class School():
    def __init__(self, max_size):
        self._students = []    # a Python list grows as needed - no fixed array, no count
        self._max_size = max_size

    def add_student(self, s):
        if len(self._students) < self._max_size:
            self._students.append(s)

    def get_count(self):
        return len(self._students)
    # ... methods below go here

ပုံစံ 1: Filter and Display (condition နဲ့ ကိုက်တာတွေကို ရွေးပြီး ပြခြင်း)

ဘာလုပ်လဲ: Array ကို loop (ထပ်ခါထပ်ခါ run တဲ့ code အပိုင်း) နဲ့ ဖြတ်သွားပြီး condition (မှန်လား မှားလား စစ်တဲ့ အခြေအနေ) တစ်ခုကို စစ်ပါ၊ ကိုက်ညီတဲ့ item (အချက်) တွေကို print ထုတ်ပါ။

Template:

public void displayByCondition(ConditionType value) {
    for (int i = 0; i < count; i++) {
        if (students[i].getField().equals(value)) {  // or == for int
            System.out.println(students[i].getName());
        }
    }
}
def display_by_condition(self, value):
    for i in range(len(self._students)):
        if self._students[i].get_field() == value:    # == works for strings AND numbers
            print(self._students[i].get_name())

ဥပမာ: ပေးထားတဲ့ house (ကျောင်းအသင်း) ထဲက ကျောင်းသား အားလုံးကို print ထုတ်ခြင်း:

public void displayByHouse(String house) {
    for (int i = 0; i < count; i++) {
        if (students[i].getHouse().equals(house)) {
            System.out.println(students[i].getName() + " - Grade " +
                students[i].getGrade());
        }
    }
}
def display_by_house(self, house):
    for i in range(len(self._students)):
        if self._students[i].get_house() == house:
            print(self._students[i].get_name() + " - Grade " +
                  str(self._students[i].get_grade()))

String (စာသား) တွေကို နှိုင်းယှဉ်တဲ့အခါ .equals() ကို အမြဲ သုံးပါ၊ == ကို ဘယ်တော့မှ မသုံးပါနဲ့။ == ကို int, double, boolean, char အတွက်ပဲ သုံးပါ။ (Python မှာတော့ ပြောင်းပြန်ပါ: == က character တွေကို တိုက်ရိုက် နှိုင်းယှဉ်တာမို့ Python string တွေအတွက် == က မှန်ပါတယ်။)


ပုံစံ 2: Count Matching Items (ကိုက်ညီတဲ့ item တွေကို ရေတွက်ခြင်း)

ဘာလုပ်လဲ: Loop နဲ့ ဖြတ်သွားပြီး condition ကို စစ်ပါ၊ ကိုက်ရင် counter (အရေအတွက် မှတ်တဲ့ variable) ကို 1 တိုးပါ၊ နောက်ဆုံးမှာ အဲဒါကို return (ရလဒ်အဖြစ် ပြန်ပေး) လုပ်ပါ။

Template:

public int countByCondition(ConditionType value) {
    int total = 0;
    for (int i = 0; i < count; i++) {
        if (students[i].getField().equals(value)) {
            total++;
        }
    }
    return total;
}
def count_by_condition(self, value):
    total = 0
    for i in range(len(self._students)):
        if self._students[i].get_field() == value:
            total = total + 1
    return total

ဥပမာ: threshold (သတ်မှတ်ထားတဲ့ အမှတ်) ထက် grade (အမှတ်) မြင့်တဲ့ ကျောင်းသားတွေကို ရေတွက်ခြင်း:

public int countAboveGrade(int threshold) {
    int total = 0;
    for (int i = 0; i < count; i++) {
        if (students[i].getGrade() > threshold) {
            total++;
        }
    }
    return total;
}
def count_above_grade(self, threshold):
    total = 0
    for i in range(len(self._students)):
        if self._students[i].get_grade() > threshold:
            total = total + 1
    return total

ပုံစံ 3: Accumulate and Return (တန်ဖိုးတွေကို စုပေါင်းပြီး ပြန်ပေးခြင်း)

ဘာလုပ်လဲ: Loop နဲ့ ဖြတ်သွားပြီး ဂဏန်း တန်ဖိုး တစ်ခုကို စုပေါင်းပါ (ပေါင်းလဒ်၊ ပျမ်းမျှ စသည်)၊ ပြီးရင် return ပြန်ပေးပါ။

Template:

public double calculateAggregate() {
    double sum = 0;
    for (int i = 0; i < count; i++) {
        sum = sum + students[i].getNumericField();
    }
    return sum / count;  // for average; just sum for total
}
def calculate_aggregate(self):
    total = 0    # not "sum" - that name is a Python built-in function
    for i in range(len(self._students)):
        total = total + self._students[i].get_numeric_field()
    return total / len(self._students)    # for average; just total for the sum

ဥပမာ: ပျမ်းမျှ grade ကို တွက်ခြင်း:

public double getAverageGrade() {
    if (count == 0) return 0;
    double sum = 0;
    for (int i = 0; i < count; i++) {
        sum = sum + students[i].getGrade();
    }
    return sum / count;
}
def get_average_grade(self):
    if len(self._students) == 0:
        return 0
    total = 0
    for i in range(len(self._students)):
        total = total + self._students[i].get_grade()
    return total / len(self._students)    # / always gives a decimal - no cast needed

ပုံစံ 4: Find by ID / Find by Name (ID နဲ့ ဒါမှမဟုတ် နာမည်နဲ့ ရှာခြင်း)

ဘာလုပ်လဲ: Loop နဲ့ ဖြတ်သွားပြီး identifier (ခွဲခြားသိနိုင်တဲ့ ID ဒါမှမဟုတ် နာမည်) ကို နှိုင်းယှဉ်ပါ၊ ကိုက်ညီတဲ့ object (class တစ်ခုကနေ ဖန်တီးထားတဲ့ instance) ကို return ပြန်ပေးပါ (ရှာမတွေ့ရင် null (ဘာ object ကိုမှ မညွှန်းတဲ့ တန်ဖိုး) ကို ပြန်ပေးပါ)။

Template:

public Student findByName(String name) {
    for (int i = 0; i < count; i++) {
        if (students[i].getName().equals(name)) {
            return students[i];
        }
    }
    return null;  // not found
}
def find_by_name(self, name):
    for i in range(len(self._students)):
        if self._students[i].get_name() == name:
            return self._students[i]
    return None    # not found - None is Python's null

Return type (method က ပြန်ပေးတဲ့ ဒေတာ အမျိုးအစား) က String ဒါမှမဟုတ် int မဟုတ်ဘဲ object type (ဥပမာ Student) ပါ။ Object တစ်ခုလုံးကို return ပြန်ပေးတော့ caller (ခေါ်တဲ့ method) က ဘယ် attribute (object ရဲ့ ဒေတာကို သိမ်းတဲ့ variable) ကိုမဆို ယူသုံးလို့ ရပါတယ်။ ကိုက်ညီတာ မတွေ့ရင် null ကို အမြဲ return ပြန်ပေးပါ: ဒါက IB မှာ စံအဖြစ် သုံးတဲ့ ရေးထုံးပါ။

ရလဒ်ကို လုံလုံခြုံခြုံ သုံးပုံ:

Student s = school.findByName("Alice");
if (s != null) {
    System.out.println(s.getName() + ": " + s.getGrade());
} else {
    System.out.println("Student not found");
}
s = school.find_by_name("Alice")
if s != None:
    print(s.get_name() + ": " + str(s.get_grade()))
else:
    print("Student not found")

ပုံစံ 5: Find Maximum / Minimum (အကြီးဆုံး ဒါမှမဟုတ် အငယ်ဆုံးကို ရှာခြင်း)

ဘာလုပ်လဲ: Loop ပတ်နေစဉ် “အခုထိ အကောင်းဆုံး” (best so far) object ကို မှတ်ထားပြီး အဆုံးမှာ return ပြန်ပေးပါ။

Template:

public Student findHighestGrade() {
    if (count == 0) return null;
    Student best = students[0];
    for (int i = 1; i < count; i++) {
        if (students[i].getGrade() > best.getGrade()) {
            best = students[i];
        }
    }
    return best;
}
def find_highest_grade(self):
    if len(self._students) == 0:
        return None
    best = self._students[0]
    for i in range(1, len(self._students)):
        if self._students[i].get_grade() > best.get_grade():
            best = self._students[i]
    return best
    # max() must not be used here - the exam wants the loop itself

အဓိက အချက်များ:

  • ပထမ element (အစုထဲက အချက်) ကို ကနဦး “best” အဖြစ် ယူပြီး စပါ
  • Index (နေရာအမှတ်) 0 က ကနဦး best ဖြစ်ပြီးသားမို့ index 1 ကနေ loop စပါ (0 ကနေ မဟုတ်ပါ)
  • Field (object ထဲက အချက်အလက် အကွက်) တွေကို တိုက်ရိုက် မယူဘဲ getter (private attribute ရဲ့ တန်ဖိုးကို ပြန်ပေးတဲ့ method) တွေနဲ့ နှိုင်းယှဉ်ပါ (field တွေက private ဖြစ်လို့ပါ)
  • တန်ဖိုး တစ်ခုတည်းကို မဟုတ်ဘဲ object ကို return ပြန်ပေးပါ

ပုံစံ 6: Nested Traversal (collection နှစ်ခုကို တစ်ခုထဲမှာ တစ်ခု ဖြတ်ကြည့်ခြင်း)

ဘာလုပ်လဲ: Collection (ဒေတာအစု) တစ်ခုထဲက item တစ်ခုစီအတွက် နောက် collection တစ်ခုထဲက item တွေကို စစ်တာ ဒါမှမဟုတ် လုပ်ဆောင်တာ လုပ်ပါ။

ဥပမာ: course နှစ်ခုလုံးမှာ စာရင်းသွင်းထားတဲ့ ကျောင်းသားတွေကို ရှာခြင်း:

public class Course {
    private String name;
    private Student[] enrolled;
    private int count;

    // constructor, addStudent, etc.

    public boolean hasStudent(String studentName) {
        for (int i = 0; i < count; i++) {
            if (enrolled[i].getName().equals(studentName)) {
                return true;
            }
        }
        return false;
    }
}
class Course():
    def __init__(self, name):
        self._name = name
        self._enrolled = []

    # add_student, etc.

    def has_student(self, student_name):
        for i in range(len(self._enrolled)):
            if self._enrolled[i].get_name() == student_name:
                return True
        return False
// Find students in BOTH courses
public static void findCommon(Course c1, Course c2, Student[] allStudents, int total) {
    for (int i = 0; i < total; i++) {
        String name = allStudents[i].getName();
        if (c1.hasStudent(name) && c2.hasStudent(name)) {
            System.out.println(name + " is in both courses");
        }
    }
}
# Find students in BOTH courses (a plain function - Python has no static keyword)
def find_common(c1, c2, all_students, total):
    for i in range(total):
        name = all_students[i].get_name()
        if c1.has_student(name) and c2.has_student(name):
            print(name, "is in both courses")

ပုံစံ 7: Remove from Collection (collection ထဲကနေ ဖယ်ထုတ်ခြင်း)

ဘာလုပ်လဲ: Item ကို ရှာပါ၊ ကျန်တဲ့ element တွေကို ဘယ်ဘက်ကို တစ်နေရာစီ ရွှေ့ပါ၊ count ကို 1 လျှော့ပါ။

public boolean removeStudent(String name) {
    for (int i = 0; i < count; i++) {
        if (students[i].getName().equals(name)) {
            // Shift everything after this position left by one
            for (int j = i; j < count - 1; j++) {
                students[j] = students[j + 1];
            }
            students[count - 1] = null;
            count--;
            return true;
        }
    }
    return false;  // not found
}
def remove_student(self, name):
    for i in range(len(self._students)):
        if self._students[i].get_name() == name:
            self._students.pop(i)    # removes the element AND closes the gap -
            return True              # Python lists do the left-shift for you
    return False    # not found

Array ထဲကနေ ဖယ်ထုတ်တဲ့အခါ ကွက်လပ်ကို ဖြည့်ဖို့ element တွေကို ဘယ်ဘက် ရွှေ့ရပါမယ်။ နောက်ဆုံး နေရာကို null ထားပြီး count ကို 1 လျှော့ပါ။ အောင်မြင်လား မအောင်မြင်ဘူးလား ပြဖို့ boolean (true ဒါမှမဟုတ် false တန်ဖိုးပဲ ယူတဲ့) ကို return ပြန်ပေးပါ။ (Python ရဲ့ pop(i) က ရွှေ့တဲ့ အလုပ်ကို အထဲမှာ လုပ်ပေးပါတယ်: အယူအဆ တူတူပဲ၊ line တစ်ကြောင်းတည်းပါ။)


ပုံစံ အနှစ်ချုပ် ဇယား

ပုံစံ Return ပြန်ပေးတာ အဓိက အချက် Null check (null ဟုတ်မဟုတ် စစ်ခြင်း) လိုလား
Filter and display void Loop ထဲမှာ print ထုတ်တယ် မလို
Count matching int Counter variable မလို
Accumulate double ဒါမှမဟုတ် int Running sum (တဖြည်းဖြည်း ပေါင်းသွားတဲ့ စုစုပေါင်း) count > 0 ဖြစ်လား စစ်ပါ
Find by ID Object ဒါမှမဟုတ် null Loop ထဲမှာ return ပြန်ပေးတယ် လိုပါတယ် (caller က စစ်ပါတယ်)
Find max/min Object ဒါမှမဟုတ် null “အခုထိ အကောင်းဆုံး” ကို မှတ်ထားတယ် count > 0 ဖြစ်လား စစ်ပါ
Nested traversal အမျိုးမျိုး Loop ထဲမှာ loop အခြေအနေပေါ် မူတည်တယ်
Remove boolean Element တွေကို ဘယ်ဘက် ရွှေ့တယ် မလို

Quick Check (အမြန် စစ်ဆေးမေးခွန်း)

Q1. findByName() method က array ထဲမှာ ကိုက်ညီတဲ့ Student ကို ရှာပါတယ်။ ကိုက်ညီတာ မတွေ့ရင် ဘာကို return ပြန်ပေးသင့်သလဲ။

Q2. "find maximum" method တစ်ခုမှာ loop ရဲ့ စတဲ့ index က ဘာ ဖြစ်သင့်သလဲ။

Q3. Item 5 ခုပါတဲ့ array ကနေ index 2 က element ကို ဖယ်ထုတ်ပြီးနောက် index 3 နဲ့ 4 က element တွေကို ဘာလုပ်ရမလဲ။

Q4. "filter and display" method ရဲ့ return type က:

Q5. ကျောင်းသား နာမည်တွေကို နှိုင်းယှဉ်တဲ့အခါ == အစား .equals() ကို ဘာကြောင့် သုံးရတာလဲ။


Trace Exercise (code ကို တစ်ဆင့်ချင်း လိုက်ကြည့်ခြင်း)

findHighestGrade() method ကို ဒီ array ပေါ်မှာ trace လုပ်ပါ။ အဖြေတွေကို English လို ရိုက်ထည့်ပါ: yes (ဟုတ်တယ်)၊ no (မဟုတ်ဘူး) နဲ့ ကျောင်းသား နာမည်။

Trace: Find Maximum ပုံစံ

// students array:
// [0] Alice, grade 85, "Red"
// [1] Bob, grade 92, "Blue"
// [2] Charlie, grade 78, "Red"
// [3] Diana, grade 95, "Blue"

Student best = students[0]; // Alice (85)
// Loop from i=1 to i=3
istudents[i]Gradebest.getGrade()best ကို update လုပ်မလား
1 Bob 92 85
2 Charlie 78
3 Diana 95

နောက်ဆုံး best: ၊ သူ့ grade:


Spot the Error (အမှား ရှာခြင်း)

ဒီ countAboveGrade method မှာ bug (code ထဲက အမှား) တစ်ခု ပါပါတယ်: total ကို loop ထဲမှာ ကြေညာထားလို့ Java က compile တောင် မလုပ်ပေးပါဘူး။

အမှား ရှာပါ: threshold ထက် grade မြင့်တဲ့ ကျောင်းသားတွေကို ရေတွက်ရမယ့် method ပါ၊ ဒါပေမယ့် compile မဖြစ်ပါဘူး: return total; က total ကို ရှာမတွေ့ပါဘူး။

1public int countAboveGrade(int threshold) { 2 for (int i = 0; i < count; i++) { 3 int total = 0; 4 if (students[i].getGrade() > threshold) { 5 total++; 6 } 7 } 8 return total; 9}

Line 3 အတွက် မှန်ကန်တဲ့ ပြင်နည်းကို ရွေးပါ:


Predict the Output (output ကို ကြိုခန့်မှန်းခြင်း)

ကျောင်းသား သုံးယောက် ရှိပါတယ်: Alice (grade 85), Bob (grade 92), Charlie (grade 78)။ ပြင်ပြီးသား countAboveGrade method ကို သုံးရင် ဒီ code က ဘာကို print ထုတ်မလဲ။

System.out.println(school.countAboveGrade(80));

Practice Exercises (လေ့ကျင့်ခန်းများ)

Core (အခြေခံ အဆင့်)

  1. House တစ်ခုထဲက grade မြင့်တဲ့ ကျောင်းသားများ: School class ကို သုံးပြီး ပေးထားတဲ့ house ထဲမှာ ရှိပြီး grade က minGrade ထက် မြင့်တဲ့ ကျောင်းသား တိုင်းရဲ့ နာမည်ကို print ထုတ်ပေးတဲ့ displayHouseAbove(String house, int minGrade) method ကို ရေးပါ။

  2. House တစ်ခုရဲ့ ပျမ်းမျှ: ပေးထားတဲ့ house ထဲက ကျောင်းသားတွေရဲ့ ပျမ်းမျှ grade ကို return ပြန်ပေးတဲ့ getHouseAverage(String house) method ကို ရေးပါ။ အဲဒီ house မှာ ကျောင်းသား မရှိရင် 0 ကို return ပြန်ပေးပါ။ ဒီ method က ဘယ် ပုံစံ နှစ်ခုကို ပေါင်းထားလဲ။

Extension (တိုးချဲ့ အဆင့်)

  1. ရှာပြီး update လုပ်ခြင်း: နာမည်နဲ့ ကျောင်းသားကို ရှာပြီး သူ့ grade ကို update လုပ်ပေးတဲ့ updateGrade(String name, int newGrade) method ကို ရေးပါ။ အောင်မြင်ရင် true၊ ကျောင်းသားကို ရှာမတွေ့ရင် false ကို return ပြန်ပေးပါ။

  2. ထိပ်ဆုံး ကျောင်းသား N ယောက်: grade အမြင့်ဆုံး ကျောင်းသား n ယောက်ရဲ့ နာမည်တွေကို print ထုတ်ပေးတဲ့ displayTopStudents(int n) method ကို ရေးပါ။ Find-maximum ပုံစံကို ထပ်ခါထပ်ခါ သုံးလို့ ရပါတယ်၊ တွေ့ပြီးသား ကျောင်းသား တိုင်းကို မှတ်ထားပြီး ထပ်မနေအောင် လုပ်ပါ။

Challenge (စိန်ခေါ်မှု အဆင့်)

  1. House report: house နာမည် တစ်ခုစီ၊ အဲဒီ house ထဲက ကျောင်းသား အရေအတွက်နဲ့ သူတို့ရဲ့ ပျမ်းမျှ grade ကို print ထုတ်ပေးတဲ့ houseReport() method ကို ရေးပါ။ House နာမည်တွေကို ကြိုမသိပါဘူး: ဒေတာထဲကနေ ရှာဖွေ သိရှိရပါမယ်။

ဆက်စပ် ခေါင်းစဉ်များ

  • အရင် လေ့လာထားရမယ့် ခေါင်းစဉ်: Classes and Objects (class နဲ့ object များ): class ဖွဲ့စည်းပုံ၊ attribute တွေ၊ method တွေ
  • အရင် လေ့လာထားရမယ့် ခေါင်းစဉ်: Encapsulation (ဒေတာနဲ့ method ကို တစ်စုတည်း ထုပ်ပိုးခြင်း): private field တွေ၊ getter/setter တွေ
  • အရင် လေ့လာထားရမယ့် ခေါင်းစဉ်: Aggregation (သီးခြား ရှိနေနိုင်တဲ့ has-a ဆက်နွယ်မှု): object တွေရဲ့ collection တွေ
  • ဆက်စပ် ခေါင်းစဉ်: 1D Arrays (တန်းတစ်တန်းတည်းမှာ စီထားတဲ့ ဒေတာအစုများ): array traversal (element တိုင်းကို အစဉ်တကျ သွားကြည့်ခြင်း) ပုံစံများ
  • ဆက်စပ် ခေါင်းစဉ်: Polymorphism (ပုံစံ အမျိုးမျိုး ယူနိုင်ခြင်း): ဒီ ပုံစံတွေက polymorphic array (မတူတဲ့ subclass တွေရဲ့ object တွေကို အတူ သိမ်းထားတဲ့ array) တွေမှာလည်း အလုပ်လုပ်ပါတယ်
  • နောက်ထပ် လေ့လာမယ့် ခေါင်းစဉ်: Selection Sort on Objects (object တွေကို selection sort နဲ့ စီခြင်း): object array တွေကို attribute အလိုက် စီခြင်း

© EduCS.me. ကွန်ပျူတာသိပ္ပံ ပညာရေးအတွက် အရင်းအမြစ်တွေ စုထားတဲ့ နေရာပါ။ EduCS is an independent educational resource. It is not affiliated with, or endorsed by, the International Baccalaureate Organization. (EduCS ဟာ သီးခြား ပညာရေး အရင်းအမြစ်တစ်ခုပါ။ International Baccalaureate Organization နဲ့ ဆက်စပ်မှု မရှိသလို သူတို့ရဲ့ ထောက်ခံချက်လည်း မရှိပါဘူး။) ဆက်သွယ်ရန်