22-ObjectArrays - apples[0] = Apple(4.0f); //MutiVitamin...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class Apple { public: float weight; Apple() { weight = 0; } Apple(float w) { weight = w; } }; class MutiVitamin { public: int B1, B2; MutiVitamin(int b1 = 0, int b2 = 0) { B1 = b1; B2 = b2; } }; int main(void) { Apple apples[10] = {1, 2, 3};
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: apples[0] = Apple(4.0f); //MutiVitamin vitamins[4] = { {1, 2}, {3, 4}, {5, 6}, {7, 8} }; MutiVitamin vitamins[4] = { MutiVitamin(1, 2)}; return 0; }...
View Full Document

Ask a homework question - tutors are online