Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

UNIT – 04 ( OOPS )

Q.1 short note on C++ and its applications


ans - C++ is a powerful, high-performance programming language that is
widely used for various applications. It was created by Bjarne Stroustrup in
1985 as an extension of the C programming language, adding object-oriented
features

key feature of c++ :


* C++ supports OOP concepts like classes, objects, inheritance, and
polymorphism, making it easier to organize and manage complex programs
* C++ is known for its high performance and efficiency, making it suitable for
resource-intensive applications.
* it has a rich standard library that provides many functions

application of c++ :
*system software – making compilers,developing os and other sytem level
software
*game development – due to high performance , choice for game developer ,
engine such like unreal engine are written in c++
others are GUI application and scientific computing

Q.2 structure of C++ program


ans -

Q.3 define namespace , identifiers , variables , constants and enum


ans-
 Variables : used to store data that can be changed during program
execution
 Constants : similar to variables , but value cannot changed once it
declared in c++
 Identifiers : names you give to things in your program like variables,
functions, and classes
for ex –
int myAge;
float heightInMeters;
void greetUser() { }
 Enum : An enum (short for enumeration) is a special list of named
values. It helps you work with sets of related constants and makes
your code easier to read and understand.
for ex -
Let's define an enum to represent the days of the week
enum Day {
SUNDAY, // 0
MONDAY, // 1
TUESDAY, // 2
WEDNESDAY, // 3
THURSDAY, // 4
FRIDAY, // 5
SATURDAY // 6
};
 Namespace : A namespace is like a container that holds a bunch of related
names (such as functions and variables) to keep them organized. Imagine it
as a folder on your computer that helps keep files with the same name but
from different projects separate.
for ex –
namespace Animals {
void speak() {
// Code for animal sounds
}
}

namespace Vehicles {
void speak() {
// Code for vehicle sounds
}
}

You might also like