Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Exact difference b/w a protected PU
Name: secrets Date: February 4, 2006 at 00:19:21 Pacific OS: Win2000/Winxp/Linux CPU/Ram: 1.7/256
Comment:
what is the exact difference b/w a protected and public???? please guide me as i am always confused abou it.
Name: SN Date: February 4, 2006 at 10:43:09 Pacific
Reply:
A protected member can be accessed by derived classes, a public member can be accessed by anybody. Protected is actually more similar to private than public.
class Animal { public GoExtinct(); protected Reproduce(); private Clone(); }
class Dog inherits Animal { function DoAll() { }this.GoExtinct();//OK }this.Reproduce();//OK because we inherit from Animal }this.Clone();//not ok - Clone() is private } }
Class Building { function DoAll() { Dog d = new Dog(); d.GoExtinct();//OK d.Reproduce();//Not OK because building doesn't inherit from Animal d.Clone();//not ok - Clone() is private } }
Summary: Hi, In c++ there is very little difference b/t a cstring & char array. It basically comes down to how you initialize them. char a[]="hello"; creates array 6 characters long...'h','e','l','l','o',and t...