constructor tag

35 questions


2 answers
82 views
0
This is a c++ char generator initialization question

#include<iostream>using namespace std;class Test{ private: char* str; public: Test(char* name){ str=name; } void hello(void){ cout << str; }};int main(){ Test ptr(lee); ptr.hello(); ...


1 answers
101 views
0
Why should the parent class constructor (in relation to inheritance and constructor) be performed first! I wonder if my guess is correct.

Ian Media is a student who is studying with a book called 'The first java programming'. I was studying inheritance and constructor, but the book said that in order for an explicit constructor or impli...


1 answers
83 views
0
Do I have to write myself to call the constructor of the parent class?

Is this the only way to call a parent class constructor in a structure where C inherits B and B inherits A?class A(object): def __init__(self): print Creator Aclass B(A): def __init__(self): super(B...


1 answers
74 views
0
To create a constructor for a C++ structure?

How do I create a construct in C++ structure?I want to define the constructor, but I don't know the grammar

2 years ago

1 answers
52 views
0
Initialize class properties What principles do you have and how do you do it?

Generator(){ var1 = getVar1(); var2 = getVar2(); }vsGenerator(){ initVar1(); initVar2(); }iniVar1(){ var1 = ...}iniVar2(){ var2 = ...}You need to know var1 to get var2 What principles do you have, ...

2 years ago

1 answers
84 views
0
[Basic Java] What happens if you don't use public when declaring the creator?

I'm a student of Java.I learned that you use public to declare a constructor.However, when coding alone, there is no error even if the public is omitted (without typing), and the corresponding constru...

2 years ago

1 answers
134 views
0
Can abstract classes also have constructors?

Can abstract classes also have constructors? If you can, how do you use it and why?


1 answers
61 views
0
What do you mean by using a static factory method instead of a constructor?

I was working on the Java program, and my friend told me to use the static factory method instead of the creator.I didn't tell you why, but I don't know what this means.


1 answers
144 views
0
I have a question for the creator of Android custom view.

I understand that if you inherit another layout when creating a custom view, you need to implement the creator belowI wonder why the defStyleAttr and defStyleRes parameters are needed and used in what...


1 answers
52 views
0
c++ constructor questions

#include <iostream>#include <cstring>using namespace std;namespace COMP_POS { enum { CLERK = 1, SENIOR, ASSIST, MANAGER }; void ShowPositionInfo(int pos) { switch (pos) { case CLERK: c...

2 years ago
« - 2 - »

© 2024 OneMinuteCode. All rights reserved.