In python whats difference between default constructor and no parameter constructor

0 votes

In python what's the difference between default constructor and no parameter constructor?

Oct 6, 2020 in Python by anonymous
• 10,480 points
158 views

1 answer to this question.

0 votes

The default constructor is called when there is no init() method in the class, in default constructor we cannot assign values to data members.

If we write init(self) in the class with only "self" as parameter then it is no parameter constructor, here we can assign values to data members like
"self.x = 10"

answered Oct 6, 2020 by Gitika
• 65,970 points

Related Questions In Python

+1 vote
1 answer

What's the difference between eval, exec, and compile in Python?

exec is not an expression: a statement ...READ MORE

answered Aug 28, 2018 in Python by Priyaj
• 58,140 points
3,016 views
0 votes
1 answer

What's the difference in Qt between setVisible, setShown and show/hide

show() is just a convenience function for ...READ MORE

answered Apr 17, 2018 in Python by anonymous
5,076 views
+1 vote
1 answer

What is the difference between range and xrange functions in Python 2.X?

xrange only stores the range params and ...READ MORE

answered Aug 22, 2018 in Python by Priyaj
• 58,140 points
1,314 views
0 votes
1 answer

Difference between module and Package in Python

A module is basically a single file ...READ MORE

answered Nov 13, 2018 in Python by SDeb
• 13,300 points
1,456 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,483 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,810 points
1,861 views
0 votes
5 answers
+1 vote
2 answers

What is the difference between .py and .pyc files in Python?

Hi, @Roshni, You can follow a few steps ...READ MORE

answered Jun 23, 2020 in Python by Gitika
• 65,970 points
7,318 views