SOLVED. Thaks to you all!!! :)
Im trying to create a vector that contains objects of another class but the compiler send me some errors.
this is the first class
ClassB.h
#pragma once
#include <string>
class B {
public:
B();
std::string Avariable = "Hi from Class´ B member";
};
this is the socond one
ClassA.h
#pragma once
#include "ClassB.h"
#include <vector>
class A {
public:
A();
std::vector <B> VectorOfB (10);
//The c++´s book says the 10 mean 10 elements in the vector
};
main.cpp
#include <iostream>
#include "ClassA.h"
int main() {
A *MyA;
MyA = new A;
//attempt to access the phrase "Hi from class´B element"
std::cout << MyA->VectorOfB[0];
}
In this link you can find it Deitel C.7 look for page 97 lines 13 and 14.