constructor tag

35 questions


1 answers
97 views
0
Why do you define a constructor with parameters and the default constructor without parameters disappears?

If you create a constructor with parameters in C#, C++, and Java, the default constructor without parameters disappears.Before, I thought it was just like that, but I suddenly became curious about why...


1 answers
98 views
0
What's the difference between new and parentheses?

When you create an instance of the Test class that I define.What's the difference between the two?Is there a difference?


1 answers
58 views
0
A message appears that there is no default constructor.

Point class, which stores coordinates of points, andRectangle class that inherits Shape.#include <iostream>#include <vector>#include <string>using std::cout;using std::endl;class Poi...

2 years ago

1 answers
124 views
0
Shallow copy process of C++ copy constructor?

//#include stdafx.h#include <iostream>using namespace std;class MyClass{public: MyClass() { pnumber = new int(5); } ~MyClass() { delete pnumber; } int number = 0; int *pnumber = nullptr;};int ...

2 years ago

1 answers
89 views
0
[Java] I ran the example in the book while I was studying, and I got an error. java.lang.NoSuchMethodError

Below is the code that was moved as it was in the book.----------------------------------------------------------------------------------------------------------class FruitSeller { int numOfApple; int...


1 answers
83 views
0
To call a parent class constructor

How does C++ call the constructor of a parent class (even a parent's parent) in a child class?In Java, we could have called the parent class constructor on the first lineWhat should I do with C++


1 answers
98 views
0
Problem with constructors if inherited from Java

Java created a Bus class that inherits the Car class as follows. Running results in an error.class Solution { public static void main(String[] args) { Bus bus = new Bus(abc,1000,1000); }}class Car{ St...

2 years ago

1 answers
82 views
0
(java)Inheritance and constructor call problems

// Parent Classclass Person { private String name; private int age; public Person(String name, int age) { this.name = name; this.age = age; } public void setName(String name) { this.name = name; } p...


1 answers
58 views
0
Question about c++ constructor.

#include <iostream>class A{ int x;public: A(int c) { x = c; std::cout << A(int c) is executed << std::endl; } A(const A &a) { x = a.x; std::cout << Create Copy <<...

2 years ago

1 answers
85 views
0
TypeScript is not recognized when you invoke a method that you assign inside the Constructor of TypeScript is not recognized.

class Block{ // // Implements about block. internal. blockProperties: Object; constructor(){ this.applyBlockPrototype(); } applyBlockPrototype(): void{ this.blockProperties = new Object(); }}If you ...

2 years ago
« - 3 - »

© 2024 OneMinuteCode. All rights reserved.