can't access constructor vars

rc\main.cpp:16:10: error: 'class A' has no member named 'p' (a.p).If I create object and access its member(a.z) then program runs with no errors. The difference is that if I create object and accessed any members being initialized, it throws an error "...no member.." above. What could be wrong about this?

I'm sorry for the unformatted post the code parameters were not working.


#include<iostream>
#include"start_it.h"

using namespace std;


int main()
{

A a;
cout<<a.p;

return 0;

};

.h
start_it.h


#ifndef START_IT_H_
#define START_IT_H_

class A
{

private:

int x = 45;
public:
int z = 67;

A(){//constructor
int o = 58;
int p = 67;
int q = 130;
int z = 200;
};
~A(){}; //destructor*/

};

#include <iostream>
#include "start_it.h"

#endif /* START_IT_H_ */
Registered users can post here. Sign in or register to post.