Re: question
From: Leor Zolman (leor_at_bdsoft.com)
Date: 05/14/04
- Next message: Elie De Brauwer: "Re: question"
- Previous message: Val: "vector::iterator usage help needed"
- In reply to: CTG: "question"
- Next in thread: Elie De Brauwer: "Re: question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 14 May 2004 01:31:13 -0400
On Fri, 14 May 2004 16:16:24 +1200, "CTG" <dontbother@yoohoo.com> wrote:
>if i have a class with only a private member function say a long
a "long"...where's this long?
>so teh construction would be
>==================
>class A(const int l)
>{
>public
>
>private:
> int l;
>}
If you're trying to say:
class A
{
public:
A(int l);
private:
int l;
};
then it would help if you actually said that. When you show code that is
so incorrect (not to mention at odds with the words you use), it is very
difficult to figure out what you're thinking...let alone what might be
causing your error. Once again: PLEASE submit code to your compiler, and
show us the same code that your compiler saw if you tell us about an error
and wish some sense to be made out of it. If you've actually done that,
then there must be lots of errors you're totally ignoring. That's not a
good thing to do.
>
>A::A(const int lparam)
>{
>l=lparam
>}
ok, that one looks good. The right number of colons and everything. Except
for the "long" part you mentioned; all you have are regular old ints. But
that's cool.
>==================
>
>and then
>have another class
>class B
>{
>public
>
>private:
> A s ;
>}
So, now perhaps you mean:
class B
{
public:
B(const A ¶mA); /* please pick one of these two... */
B(A paramA) /* did any of what I told you about const get through? */
private:
A s;
};
>
>in the construction of B
>B:B(const A paramA)
Either:
B::B(const A ¶mA)
OR:
B::B(A paramA)
>{
>s=paramA /// CAN I DO THIS ???????
Sure, you should be able to, if the preceding code were to be correct. Why
did you get the error? Who in God's name can tell, when you either haven't
shown us the code you've actually tried to compile, or you've ignored all
the previous errors? And if this IS the code you've actually tried to
compile, you'd have to fix the umpteen errors you would have gotten
previous to this one, before it makes any sense to think about this one.
For one thing, the compiler probably would have choked on your definition
of class A, so it wouldn't accept a subsequent definition of an A object
(such as s)...
-leor
>}
>
>well teh compiler does not like it
>rror C2065: 's' : undeclared identifier why?
-- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
- Next message: Elie De Brauwer: "Re: question"
- Previous message: Val: "vector::iterator usage help needed"
- In reply to: CTG: "question"
- Next in thread: Elie De Brauwer: "Re: question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|