...
Question 10874 – JAVA
November 12, 2023
Question 16117 – I/O-Devices
November 12, 2023
Question 10874 – JAVA
November 12, 2023
Question 16117 – I/O-Devices
November 12, 2023

Question 17043 – JAVA

If a constructor ‘Date’ is declared explicitly and has to be defined outside the class, which of the following is correct?

Correct Answer: A

Question 8 Explanation: 
Defining a Constructor Outside of the Class :Although the constructor can be defined outside of the class, it must be declared inside class. Use the scope resolution operator while defining a constructor outside of the class.
class class_name {
public:
class_name();
};

// Defining a Constructor Outside of the Class by using :: operator
class_name::class_name()
{
}

A
Date::Date(int dd) {/*…*/}
B
explicit Date::Date(int dd) {/*…*/}
C
Such a constructor cannot be defined
D
Constructor always has to be defined inside the class
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!