Skip to content

Tag Archives: Constructors

In JavaScript, there are two ways to create a promise: using the Promise.resolve method or using the new Promise constructor. While both ways achieve the… Read More
This article focuses on function/method overloads by references, as well as the types of arguments that can be passed. Prerequisites: l-value references. r-value references. Move… Read More
Prerequisites: lvalue reference rvalue reference Copy Semantics (Copy Constructor) References: In C++ there are two types of references- lvalue reference: An lvalue is an expression… Read More
The export statement is used to bind one JavaScript module to others. In order to export the default constructor, we use an export statement and… Read More
In this article, we will discuss the problem of initialization in C++, the data members of a class have private scope by default, so they… Read More
In general, creating a copy of an object means to create an exact replica of the object having the same literal value, data type, and… Read More
In Object Oriented Programming, Objects are the instances of a class which has its own state(variables) and behavior(methods).  Every class has two special methods related… Read More
Prerequisites: l-value and r-value references in C++, Copy Constructor in C++. What is a Move Constructor?   The copy constructors in C++ work with the… Read More
We use new and delete operators in C++ to dynamically allocate memory whereas malloc() and free() functions are also used for the same purpose in… Read More
class Test {     static int a;            static     {         a = 4;         System.out.println ("inside static block\n");         System.out.println ("a = " + a);     }            Test()… Read More
final class Complex {     private  double re,  im;     public Complex(double re, double im) { = re; = im;     }     Complex(Complex c)     {       System.out.println("Copy… Read More
Output of following Java program class Point {   int m_x, m_y;        public Point(int x, int y) { m_x = x; m_y = y; }… Read More
Is there any compiler error in the below Java program? class Point {     int m_x, m_y;      public Point(int x, int y) {    m_x = x;   … Read More
Which of the following is/are true about constructors in Java? 1) Constructor name should be same as class name. 2) If you don't define a… Read More
Predict the output of following Java program class T {   int t = 20;   T() {     t = 40;   } } class Main {    public… Read More

Start Your Coding Journey Now!