Inheritance and non-parameterized constructors

Inheritance and non-parameterized constructors

Lesson Details:
June 29, 2020


I: Introduction

Before you start programming you need to understand some basic concepts about programming languages. A programming language is a language used to create instructions that are understandable by the computer. It is made up of symbols, words, characters or signs which are called tokens. A token can also be called an identifier, operator, keyword, string, etc. Tokens are grouped into statements by punctuation marks like semicolon, new line etc.

Python is a general-purpose programming language that is interpreted. It was created by Guido van Rossum in 1989. Python is an object-oriented programming language and uses dynamic typing. It supports multiple programming paradigms including imperative, functional and object-oriented. It has automatic memory management and dynamic type. The syntax of python is more difficult than other languages but it is more powerful than other languages.

II: Body

In this section we are going to discuss inheritance and non-parameterized constructors. Inheritance is a way of reusing source code for different types of classes. For example, if you want to create a Circle class that inherits from the Shape class, then you can use the Shape class as the base class for the Circle class. When you inherit from another class, you are creating a new class that has the same members (variables and functions) as the class it is inheriting from. You can also add new properties and functions to the inherited class.

Non-parameterized constructors are also known as default constructors. If you do not write the constructor yourself then the compiler will create one for you. This constructor does not take any parameters. If you want to instantiate an object then you cannot call its constructor without parameters. If you don’t provide any parameters then the constructor will invoke implicitly; if no meaningful behavior can be invoked then it will raise an exception. You can define your own parameterized constructors or override the default constructor of the class.

III: Conclusion

You have learned what is Programming Languages, Inheritance and Non-parameterized constructors in python programming.

loader
Course content