class tag

88 questions


1 answers
128 views
0
I can't do the questions while studying Python class. The wrong place

I'm studying about Python class!I defined the class and proceeded, but it was executed, but the result didn't come outI ask for your help me.class myObj(object): def set_value(self, item): self.item=...

2 years ago

1 answers
165 views
0
Can't the constructor be called when creating a temporary object with a return value?

#include <iostream>class Point{ int x, y;public: Point (int a = 0, int b = 0): x(a), y(b) {std::cout << execute creator<< std::endl;} friend Point operator+(const Point& p1, cons...


1 answers
79 views
0
Add Python Dictionary Value and Output to String

class HashMap: def __init__(self): self.vals = {} def insert(self, key, val): self.vals = {key:val} def __str__(self): result = '' for i in self.vals.items(): result = result + str(i) + ',' retu...

2 years ago

2 answers
167 views
0
Here's a question for Java class conversion!

I am studying Java again, and I am posting a question because I have a question.public class super{ public int one= 11; public int two= 22; public void one_method() { System.out.println(super one_met...

2 years ago

1 answers
150 views
0
What is the difference between a class variable and an instance variable?

What is the difference between a class variable and an instance variable?

2 years ago

1 answers
121 views
0
Is there a way to combine the results of the events into one and hand them over to other classes?

For example, in the class Fragment 1, there are various events [Spinner, Switch, SeekBar] and so onIs there a way to put the initial values of these events together and put them in Message.obj and sen...

2 years ago

1 answers
77 views
0
Description of public, private, protected

I saw the professor's PPT that distinguished the types of methods in the class diagrampublic - Access control to disclose one's attributes or actions to the outside worldPrivate-Access control accessi...

2 years ago

1 answers
107 views
0
When creating a class, how do I compare the class(type) object that is being created in the __eq__ function?

For example, class num def __init__(self,input_parm): self.num = int(input_parm) def __eq__(self, other):In this case (switch the input to an integer and store it as an initialization value)When inp...

2 years ago

2 answers
145 views
0
Why do you add self when calling a function?

def sum(self): resurt = 0 for num in self.numberlist: resurt += num return resurtdef avg(self): total = self.sum() return total/ len(self.numberlist)Medium total = self.Why is self in sum()?

2 years ago

1 answers
59 views
0
Why are properties created that are not in Python class __slots__?

class b(): __slots__=['a'] c=1one=b()one.a=1try: one.b=2except: print(Cannot be created)print(one.a)class q(): passclass w(q): __slots__=['a']two=w()two.a=1two.b=2print(two.a, two.b)In class b, slots ...

2 years ago
« - 3 - »

© 2024 OneMinuteCode. All rights reserved.