FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


C++ help





vignesh_natraj
when i inherit a class ie derieve a new clas from am existing class there is a problem.For eg if i get input for a variable in super class and display it in the subclass a garbage value is printed.
elekis
could you put some code and the error.

second thing witch compiler do you use, witch platform (linux or windows)

etc...etc...

a little bit more explanation please


a++
vignesh_natraj
i use vi editor in Mac. more briefly i get input for a variable named x using the super class's object and when i print it[x] using the sub class's object , it prints a grbage value.\
BruceTheDauber
vignesh_natraj wrote:
when i inherit a class ie derieve a new clas from am existing class there is a problem.For eg if i get input for a variable in super class and display it in the subclass a garbage value is printed.


Clarification... You mean, you do something like this:

Code:
class Sub {
public:
string s;
virtual string input () { s = "fish"; return s; }
};

class Super: public Sub {
public:
string input() { s = "chicken"; return s; }
};

Super x;
Sub * p = &x;
cout << p->input();


...and you get nonsense?

How does the above differ from what you're doing? If you posted an actual snippet of code, people might be able to spot the problem. A vague description is likely to get you nowhere.
[/code]
Related topics
Help with C++
HELP ME in C++
[Question] Visual Basic C++, PHP, mySQL language guides...
HELP!!!! My computer keeps rebooting over and over again.
Laptop and Network problems.. help please
C++ (how to make a game)
Need help in Borland C++ 3.0
C++ help
Learning C#
C++ assignment help
c++ object design help
Basic C Programming Help?
Help With C++ Searching
I think I'm in Hell .....
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.