Copy constructor A copy constructor is a constructor that copies all the information of an object by passing the object as an argument to a function. The compiler defines a default copy constructor if copy constructor is not defined. Usually, a copy constructor is used for copying objects. For example, in a game, you use it to create multiple monsters. The basic form of a copy constructor 123cla..
Inheritance C++ commonly uses inheritance functionality to prevent unnecessary copy which could cause duplication and severe errors. It allows to create many similar classes from a base class and performs them differently. Even though parent class has many child classes, only the class, that we want to change, can be modified without affecting other classes. Less code and errors mean less expens..
Constructor and Destructor with simple example code - Constructors are called as soon as an object is created - It does not have a return type and has the same name as class name. - In case there is no constructor or destructor, the compiler creates default constructor or destructor but if there is at least one constructor, the default constructor is not created by default. - They both have to b..
Encapsulation (getters and setters) in C++ In C++, encapsulation is a very popular feature to hide data. All data members have to be private so outside entities are not able to access the data directly. It protects the data from modifying. If change is needed, getter and setter function should be set to access the private data from outside. Example code
Reference in C++ the lvalue can only be assigned to ReferenceReference is alias which is another name of existing variablePointer has a different address but the Reference has the same address with the variable. Address of the variable does not need to be copied Example code Result
Class and Object in C++ Data and functions are created in class and an object is created through a class.How to declare an object is almost the same way which we declare normal variables.Class members are private by default.To allocate memory, a name should be given as an instance Example code
- Total
- Today
- Yesterday
- hackerrank javascript
- Collection Framework
- hackerrank
- 프로그래머스
- repeat()
- code refactoring
- substring()
- equals()
- 알고리즘
- Javascript Algorithm
- spring boot application
- HackerRank Algorithm
- 프로그래머스 알고리즘
- hackerrank javascript solution
- string class in java
- 프로그래머스 알고리즘문제
- easy javascript algorithm
- java
- algorithm
- ... in Javascript
- HashMap
- math.max
- compareTo()
- C++
- javascript
- Object type casting
- easy algorithm
- math.abs
- rest parameter
- hackerrank solution
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |