Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Guten Abend,

dies ist höchst warscheinlich ein denkbar einfach zu lösendes Problem, allerdings komme ich nicht ganz dahinter. (Ich nutze den VSC++ Compiler)

Wenn ich ein Objekt der Klasse Bow erzeugen möchte, teilt mir der Compiler mit das für eben diese Klasse ein geeigneter Standartkonstruktor verfügbar ist.

Ich verstehe das nicht, da ich zum einen, einen Konstruktor sowie einen destruktor bereitstelle.

class Bow

{

string color;

bool drawn;

int numOfArrows;


public:

Bow(string aColor);

~Bow();

void draw();

int fire();

};


Bow::Bow(string aColor)

{

using std::srand;

using std::time;

numOfArrows = 10;

drawn = false;

color = aColor;

srand(time(0));

}

Bow::~Bow()

{

}

int Bow::fire()

{

using std::cout;

using std::rand;

if(!drawn)

{

cout << color << " has not been drawn "

<< "and therefore could not fire.\n";

return 0;

}

int score;

score = rand() % (10 - 0 + 1) + 0;

if(score == 0)

cout << color << " missed the target!!!\n";

else

cout << color << " scored " << score << " points!!!\n";

return score;

}


void Bow::draw()

{

using std::cout;

drawn = true;

cout << "The " << color << " bow has been drawn.\n";

}

lg

Gateway

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.