C++ Oops: What to Watch Out For

C++ Oops: What to Watch Out For

**Some keypoints to be noted

ยท

1 min read

Table of contents

No heading

No headings in the article.

FOR EMPTY CLASS: If properties is not written in code then the output will be 1. It's size is not zero because for the rectification it gives 1 byte to keep track of it.

GREEDY ALIGNMENT: A technique used to minimize padding in memory layout for class object.

PADDING: Adding some extra bit so that the operating system can work smoothly.

COPY ASSIGNMENT OPERATOR: It is called when the already created object is assigned a new value from another existing object. It is basically a bitwise operator.

SCOPE RESOLUTION OPERATOR: To access global variable when there is a local variable with same name. To define a function outside the class.

LOCAL VARIABLE: Accessible inside the function.

GLOBAL VARIABLE: Declared at the top of program outside the function.

STATIC DATA MEMBER: Class member that are declared using static keywords.

CONSTRUCTOR OVERLOADING: If we have multiple constructors under same class of different arguments then the argument set which matches that constructor will be run.

CONSTRUCTOR WITH DEFAULT ARGEMENTS: It means that if the constructor is defined with n parameters, we can invoke it with less than n arguments specified in the call.

CONSTRUCTOR IN DERIVED CLASS:

CASE 1: class B: public A(order of execution=A,B)

CASE 2: class A: public B, public C(order of execution=B,C,A)

CASE 3: class A:public B, virtual public C(order of execution=C,B,A)

ย