Questions tagged [object-construction]

For questions related to object construction, usually in an OOP environment.

Construction is a concept of Object-Oriented languages.

Objects need to be setup for use:

  • Their member variables need to be allocated
  • Any Object member variables also need to be constructed
  • The Object methods need to be setup for calling

This process is accomplished by construction.

95 questions
-1
votes
1 answer

C++: Copying Objects Using Memmove and Malloc

I was playing around templates when I was surprised that the code below doesn't work as expected: #include #include #include template class CreatorTWO { public: CreatorTWO (void) {} ~CreatorTWO…
R34
  • 59
  • 6
-1
votes
3 answers

What is true reason for initiliazing need of final varibles before use

I know that: A blank final class variable must be definitely assigned by a static initializer of the class in which it is declared, or a compile-time error occurs. A blank final instance variable must be definitely assigned at the end of…
-2
votes
1 answer

why do i not return anything from my constructor function?

function Person (name, eyeColor, age) { this.name = name; this.eyeColor = eyeColor; this.age = age; this.updateAge = function () { return ++this.age; }; } let person1 = new Person("kevin", "blue", 34); // normalli would have to return…
user13752749
-2
votes
1 answer

Problem constructing a base class from within a subclass constructor

I have 2 classes. Since Doctor will be considered as Employee, I should be using Employee class functions in Doctor class. Only extra thing that Doctor class has is TITLE. Basically, What I tried is I wanted to send value to Doctor's constructor,set…
-3
votes
2 answers

Representing a value which can't be ctor-initialization-list initialized

I'm writing a class C with a member foo of type foo_t. This member must be defined and valid throughout the liftime of a C instance; however, I don't have the necessary information to construct it at compile time, i.e. I can't use class C { …
einpoklum
  • 118,144
  • 57
  • 340
  • 684
1 2 3 4 5 6
7