Answer:
Following are the solution to the given point:
Explanation:
The solution to this question is defined in the attached in the attached file.
StrawberryTeaa (could be any fruit: blueberry, peach, etc)
potatoxchip
pastelsquid
SquishyPeach
GummiBear
ElegantFlaws (could add an e and remove the s: EleganteFlaw)
hunnie_b (or honee, honnie, hunni, etc)
agonyisheree
It's cool if you don't like these. I had trouble when I changed my user too. But you'll find your perfect username eventually. :)
Answer:
sample_str = "Help me pass!"
first_chars = sample_str[0:4]
print('First four character: ', first_chars)
Explanation:
sample_str = "Help me pass!"
first_chars = sample_str[0:4]
H has index 0, e has index 1, l has index 2, p has index 3. the space has an index as well, etc.
Answer:
Encapsulation:-It is the binding of the data and functions so that they works as one unit.
Inheritance:-When one class acquires the property of another class it is called inheritance.
Polymorphism :-It generally means more than one form
Explanation:
Encapsulation:- class is an example of encapsulation it can hold different data types and functions in a single container called class.
class Name{
public:
string first_name;
string last_name;
void Display()
{
cout<<first_name<<" "<<last_name<<endl;
}
};
Inheritance:-The property of a class acquiring the properties of another class is called inheritance.
Now we will inherit the above defined class.
class person: public Name
{
public:
char gender;
int age;
void Display()
{
cout<<first_name<<" "<<last_name<<gender<<age<<endl;
}
};
int main()
{
Name n;
person p;
n.Display();
p.Display();
}
Polymorphism- There are two types of polymorphism:-
1.Run time polymorphism=The values are decided at run time.
2.Compile time polymorphism=The values are decided at compile time.
Example:-In the above example we have function Display() in both the classes.This is an example of compile-time polymorphism. We are deciding at the time of compilation which display to use.