class tag

88 questions


1 answers
114 views
0
This is a question for the Java Scanner!

When I declare a field and declare a method after creating one class, if I need a scanner in several methods, should I declare and close the scanner for each method??And I created several classes, and...


1 answers
129 views
0
(Python) How do I write code?

class Account: def __init__(self, money): self.__money = moneyclass AccountManager: def __init__(self): self.__accList[] def newAcc(self): global Name global money self.__accList.append(Name) ##...

2 years ago

1 answers
147 views
0
Undo list node

We used classes and structures to mimic the listWhen you release a node, will all the things in the heap area be released if you have the code below?I copied a part of the code, but if I can't judge w...

2 years ago

1 answers
85 views
0
JAVA beginner's question. Why is the result zero?

package Calc;import java.util.Scanner;class Calculator{ int a,b; void setOprands(int a,int b) { this.a = a; this.b = b; } int sum() { return this.a+this.b; } void plus() { } void minus() { } void r...

2 years ago

1 answers
97 views
0
While practicing classes in winapi, how do I export to the getter setter or change the value of the imported variable?

// Declare score variables in the Player classm_nScore;Player::Init(){ m_nScore = 0;}// Getter int GetPlayerScore() { return m_nScore; }// Dynamic Assignmentm_pObjects = new Objects;m_pObjects->Set...

2 years ago

1 answers
102 views
0
class member variable pointer? When do you use it?

class Car{ public: int speed;};int main(){ int Car::*pSpeed = &Car::speed; return 0;}I saw this code, and I wonder when int Car::*pSpeed=&Car::speed; is used in main.

2 years ago

1 answers
80 views
0
Output Questions

#include <stdio.h>class myclass {public: myclass() { printf(a); } myclass(myclass& r) { printf(b); } void operator = (myclass& r){ printf(c); } };int main(){ myclass a; myclass b(a); myc...

2 years ago

1 answers
144 views
0
When you want to extend another class in Fragment,

public class Main_Title_Fragment : Fragment{ ImageButton _Back_Button, _Exit_Button; TextView _Title_Text; FragmentTransaction _Main_Menu_Fragment; FragmentManager _Back_Stack; public override void On...

2 years ago

1 answers
82 views
0
Is there a way to prevent the private field of the class from being modified?

public class Test{ private String[] arr = new String[]{1,2}; public String[] getArr() { return arr; }}When there's a code like this

2 years ago

1 answers
98 views
0
Why can't you create static methods in an abstract class?

abstract class foo { abstract void bar(); // <-- Pig abstract static void bar2(); //<-- No}Why can't you define a static method for an abstract class like above?

« - 5 - »

© 2024 OneMinuteCode. All rights reserved.