1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Sladkaya [172]
4 years ago
15

Create a class Str that subclasses str. Add a method to the subclass that checks if the string does not start with a given strin

g. Call that method notstartswith
Computers and Technology
1 answer:
Stolb23 [73]4 years ago
3 0

Answer:

#include <iostream>

using namespace std;

class Str{  ///baseclass

   public :

   string super_str;

   string getStr()

   {

       return super_str;

   }

   void setStr(string String)

   {

       super_str=String;

   }

};

class str : public Str{   //inheriting Str publicly

   public :

       string sub_str;

       string getstr()

       {

           return sub_str;

       }

       void setstr(string String)

       {

           sub_str=String;

       }

       bool notstartswith()

       {

           int n=sub_str.length();   //to find length of substr

           bool flag=false;

           for(int i=0;i<n;i++)     //Loop to check beginning of Str

           {

               if(super_str[i]!=sub_str[i])

               {

                   flag=true;

                   break;

               }

           }

           return flag;

       }

};

int main()

{

   str s;    //object of subclass

   s.setStr("Helloworld");  

   s.setstr("Hey");

   if(s.notstartswith()==1)     //checking if str is substring of Str

       cout<<"Str does not start with str";

   else

       cout<<"Str starts with str";

   return 0;

}

OUTPUT :

Str does not start with str

Explanation:

Above program is implemented the way as mentioned. for loop is being used to check the beginning of the str starts with substring or not.

You might be interested in
A finance company wants to upgrade its accounting software to a higher version. This version change requires a change in data fo
Alina [70]

Answer:

The answer to this question is option b which is data re-engineering.

Explanation:

In computer science, data re-engineering is a part of the software development life cycle(SDLC). In the SDLC the data re-engineering is a technique that provides the facility to increase the size of the data formats, design,data-view, etc. It is also known as the software development process in this process, there are seven-stage for software development. If we want to upgrade the software to use the data re-engineering technique so we used the software development process. We use only this process to develop the software because there is no other process to development. So the correct answer is data re-engineering

4 0
3 years ago
Read 2 more answers
Think of an example in your life where a number could be described as data, information, and knowledge
zhannawk [14.2K]

Answer:

how many event you have been too in the last month (well non during this time but as an example)

Explanation:

4 0
3 years ago
You are applying for a secretary position. You have many skills but which of the following would not be one to include on the ap
zepelin [54]

A. How many marathons you have run, because it doesn't relate to the job you're applying for.

6 0
3 years ago
Read 2 more answers
What pointer appears when pointing to a hyperlink
Leokris [45]
Your answer would be: a hand pointer.
6 0
3 years ago
Read 2 more answers
A restaurant buys a pizza oven that is 4.5 feet long, 5 feet wide and 6 feet tall. What is the volume of the pizza oven?
torisob [31]

Answer:

135 as 4.5 times 5 times 6 gives you the volume and it =135

4 0
3 years ago
Other questions:
  • A USB zipper drive is a small data storage device that plugs into a computer's USB port.
    14·1 answer
  • What kind of game was pole position?
    6·2 answers
  • .in the array based list implementation of the ADT what is the worst case time efficiency of the remove method?
    6·1 answer
  • General equation: y = (89 / 27) - z * x + a / (a % 2) (recall: a is an integer; the 89 and 27 constants in the equation should b
    14·1 answer
  • According to Caroline Heldman, what product was pulled from Abercrombie and Fitch stores based on protests through a blog
    11·1 answer
  • What help in executing commands quickly
    5·1 answer
  • have you ever had to adjust your communicatio style to egage a customer or roommate? what was the situation and outcome?
    5·1 answer
  • 3.6 Code Practice on Edhesive
    10·1 answer
  • HURRY please!!!!
    13·1 answer
  • 1. You are given a database to create, however, you realize that in the instructions you are told to create relationships betwee
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!