What is OOP and what are its four pillars in PHP? OOP क्या है और PHP में इसके चार pillars कौन से हैं?
Short Answer
On the web, you can mix visual styles by applying different CSS font-family rules to inline HTML elements like <span>. You would use a cursive web font (like from Google Fonts) for the "handwritten" text, and a standard sans-serif/serif font for the normal text.
Code Example
1. Import a cursive font:
<link href="https://fonts.googleapis.com/css2?family=Caveat&display=swap" rel="stylesheet">
2. Create the CSS and HTML:
<style>
.normal-text {
font-family: 'Arial', sans-serif;
font-size: 16px;
}
.handwriting {
font-family: 'Caveat', cursive;
font-size: 24px;
color: blue; /* Looks like pen ink */
}
</style>
<p class="normal-text">
Please sign here: <span class="handwriting">Prepiq User</span>
</p>
OOP (Object-Oriented Programming) कोड को objects के इर्द-गिर्द organize करता है जो data और behavior को साथ रखते हैं, अलग-अलग functions की सपाट लिस्ट के बजाय। PHP 5 से पूरी तरह OOP सपोर्ट करता है।
| Pillar | मतलब |
|---|---|
| Encapsulation | data और methods को साथ बांधना, access modifiers से internal state छुपाना |
| Inheritance | एक class दूसरी class के properties/methods reuse और extend करती है |
| Polymorphism | same method नाम अलग-अलग classes में अलग व्यवहार करता है |
| Abstraction | सिर्फ ज़रूरी डिटेल दिखाना, implementation की जटिलता छुपाना |
इंटरव्यू टिप: सिर्फ definition नहीं, अपने किसी प्रोजेक्ट से हर pillar का असली उदाहरण देने के लिए तैयार रहें।
Was this answer clear?