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 in Python by anonymous
• 6,190 points
34 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 by Gitika
• 50,820 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
• 57,700 points
1,945 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
3,634 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
• 57,700 points
912 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,250 points
962 views
+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 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 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,800 points
1,186 views
0 votes
1 answer

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

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

answered Jun 23 in Python by Gitika
• 50,820 points
762 views
0 votes
1 answer

What is the difference between visual studio and idle in python programming??

Both are actually IDE-s I don't know ...READ MORE

answered Oct 16 in Python by Gitika
• 50,820 points
46 views