My Blog

My WordPress Blog

My Blog

My WordPress Blog

Day: October 3, 2024

Inheritance

What is Inheritance in Python? Inheritance is one of the most important features of object-oriented programming languages like Python. It is used to inherit the properties and behaviours of one class to another. The class that inherits another class is called a child class and the class that gets inherited is called a base class or parent class. If […]

Type Casting

The term “Type Casting” refers to conversion of one type of data to another. Since PHP is a weakly typed language, the parser coerces certain data types into others while performing certain operations. For example, a string having digits is converted to integer if it is one of the operands involved in the addition operation. […]

Access Modifiers

The Python access modifiers are used to restrict access to class members (i.e., variables and methods) from outside the class. There are three types of access modifiers namely public, protected, and private. Usually, methods are defined as public and instance variable are private. This arrangement of private instance variables and public methods ensures implementation of principle of […]

Data Types

The term “data types” refers to the classification of data in distinct categories. PHP has a total of eight data types that we use to construct our variables − The first five are simple types, and the next two (arrays and objects) are compound types. The compound types can package up other arbitrary values of […]

Constructors

Python constructor is an instance method in a class, that is automatically called whenever a new object of the class is created. The constructor’s role is to assign value to instance variables as soon as the object is declared. Python uses a special method called __init__() to initialize the instance variables for the object, as soon as it is […]

Static Methods

What is Python Static Method? In Python, a static method is a type of method that does not require any instance to be called. It is very similar to the class method but the difference is that the static method doesn’t have a mandatory argument like reference to the object − self or reference to the class − cls. Static […]

Magic Constants

The magical constants in PHP are predefined constants. They are available to any script on which they run, and they change depending on where they are used. All these “magical” constants are resolved at compile time, unlike regular constants, which are resolved at runtime. There are nine magical constants in PHP. These special constants are […]

Class Methods

Methods belongs to an object of a class and used to perform specific operations. We can divide Python methods in three different categories, which are class method, instance method and static method. A Python class method is a method that is bound to the class and not to the instance of the class. It can be called on […]

Constants

A constant in PHP is a name or an identifier for a simple value. A constant value cannot change during the execution of the PHP script. Examples of Valid and Invalid Constant Names in PHP Here are some examples of valid and invalid constant names in PHP − Difference between Constants and Variables in PHP […]

Scroll to top