Skip to main content

Command Palette

Search for a command to run...

Object Oriented Programming

Published
1 min read
U

Writing blogs on what i learnt so that i could refer them later :)

Class: a class is a blueprint or template for creating objects. It defines the structure and behavior (attributes and methods) that the objects created from the class will have.
classes are basically user defined data types.

// static allocation : Memory is allocated at compile-time (before the program runs) for variables or objects.
Scope: Variables are created on the stack (local variables) or in global/static memory (global/static variables).
int a;

// dynamic allocation: Memory is allocated at runtime (while the program is running) using operators like new and delete
Scope: Memory is allocated on the heap and needs to be explicitly managed by the programmer.
int *a= new int;