Thread: 'i' : cannot access private member declared in class 'a'

  1. #16
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by juice View Post
    And I don't know what u meant wen u said "Oh, you're from India, it's time you read my sig-link then", but f*** u if u try to disrespect me or my nation. And I mean it sir.
    Wrong person to smart off to my friend.
    Last edited by AndrewHunter; 09-28-2011 at 02:05 AM.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by juice
    And I don't know what u meant wen u said "Oh, you're from India, it's time you read my sig-link then"
    Basically, read this article: India Graduates Millions, but Too Few Are Fit to Hire - WSJ.com.

    If we were working on the same team and I observed that you reached for the trick you so proudly displayed in post #10, I would fire you if I had the authority, or recommend your termination if I did not. The thing is, without proper learning materials, such an ad hoc learning process as you appear to be using now will cause you to be unable to differentiate the good from the bad.

    Suppose I had seen you make posts that clearly showed that you understood C++ member access control, and overall I can see that you have a good foundation in C++. Then, I would see your post #10 as something that you found interesting, but I would trust that you understand why it should not be used in practice. But in this thread, you were unable to even make use of access control under normal circumstances in a simple scenario, so seeing you write what you did makes me seriously doubt that you are learning the right things.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    If my presence is not appreciated, am out a here...Good bye..... and there is nothing special with the use of pointers to access private variables, the only reason why I posted it was because I was online and was already discussing something with u people, but that's fine

  4. #19
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by juice View Post
    If my presence is not appreciated, am out a here...Good bye..... and there is nothing special with the use of pointers to access private variables, the only reason why I posted it was because I was online and was already discussing something with u people, but that's fine
    The thing that is 'special' about it, is you are making a big assumption about the implementation of the class. Like I said, you are using an offsetof trick. This is not guaranteed to work for all implementations and for all cases and as such should be avoided.

    Drop the attitude.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  5. #20
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by juice
    If my presence is not appreciated, am out a here...
    We are certainly not telling you to go away, but of course you have that option.

    Quote Originally Posted by juice
    there is nothing special with the use of pointers to access private variables
    Special? Probably not. Wrong? It depends. What is wrong is an attempt to bypass intentional access control. The fact that you are using a pointer is not so important.

    Quote Originally Posted by juice
    the only reason why I posted it was because I was online and was already discussing something with u people, but that's fine
    The "something" that you were discussing is directly related, so this explanation does not make sense.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #21
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    Thats fine sir. I am new to programming, and I still have a long way to go. And I am in no state to suggest something to people like u. But I still believe that its better to invest time in learning something new and better, rather than looking for which country sucks at what and jeering at people. Plus I only joined this forum cause I found it helpful and people to be kind and supportive, but this is something that will certainly alter my beliefs.
    Last edited by juice; 09-28-2011 at 02:32 AM.

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by juice
    rather than looking for which country sucks at what
    If you actually read the article, you would see that its main point is that "the Indian education system needs to change its entire orientation to focus on learning", which is a quote from Saurabh Govil, "senior vice president in human resources at Wipro Technologies (...) India's third largest software exporter by sales". Where this applies to you is for you to take caution in your own education, i.e., be aware that your instructors and instructional material may be doing you a disservice, so you should seek what really brings you proper learning.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #23
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    I'll see to that. And thanks for the advice, but I strictly believe salem needs to change the way he talks..

  9. #24
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by juice View Post
    I'll see to that. And thanks for the advice, but I strictly believe salem needs to change the way he talks..
    On this risk of starting this discussion up again (which I do not want but it needs to be said), Salem does not need to change what he does. Sometimes he comes across a little crass, but honestly he has earned it. He has established his knowledge and ability to contribute with this forum. You my friend have not, and as such should mind your manners. This isn't just because we are on an internet forum, this is life. No matter where you are you always need to mind your elders, in this forum and the topic of programming in general, Salem is your elder. Show some respect and stop with the backtalk, otherwise you will find you stay here unhelpful and you might as well just leave.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  10. #25
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    How old is salem.

  11. #26
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by juice View Post
    How old is salem.
    Older than you; and if not you are seriously behind the learning curve for this profession.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  12. #27
    Registered User
    Join Date
    Aug 2011
    Posts
    385
    Well thats fine and it doesn't really matter how old is he cause I respected him for whatever he was, but just because u r 122 years old does not mean u will demean or disrespect somebody....

  13. #28
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Regardless of Salem's age, Salem is at least your elder when it comes to programming.
    And as you understand, when it comes to a specific field where there is an elder, you listen. They often give good advice, as does Salem.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  14. #29
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by juice View Post
    Well thats fine and it doesn't really matter how old is he cause I respected him for whatever he was, but just because u r 122 years old does not mean u will demean or disrespect somebody....
    He wasn't; it was a warning as Laser explained. If you want to be a programmer you have to understand that the "norm" is being direct and to the point. In fact Salem was actually the first one to post a solution to your original problem.

    I strongly recommend dropping this. Laser already explained the responses you recieved to the offsetof trick; I do not think there is anything more to discuss.
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  15. #30
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by Elysia View Post
    Regardless of Salem's age, Salem is at least your elder when it comes to programming.
    And as you understand, when it comes to a specific field where there is an elder, you listen. They often give good advice, as does Salem.
    Quote Originally Posted by AndrewHunter View Post
    On this risk of starting this discussion up again (which I do not want but it needs to be said), Salem does not need to change what he does. Sometimes he comes across a little crass, but honestly he has earned it. He has established his knowledge and ability to contribute with this forum. You my friend have not, and as such should mind your manners. This isn't just because we are on an internet forum, this is life. No matter where you are you always need to mind your elders, in this forum and the topic of programming in general, Salem is your elder. Show some respect and stop with the backtalk, otherwise you will find you stay here unhelpful and you might as well just leave.
    It appears we agree again.....
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can Nested class access parent class's private member?
    By meili100 in forum C++ Programming
    Replies: 4
    Last Post: 06-05-2009, 08:42 AM
  2. cannot access private member declared in class
    By newme in forum C++ Programming
    Replies: 7
    Last Post: 11-16-2008, 03:57 PM
  3. private class member access
    By DarkMasterBosel in forum C++ Programming
    Replies: 6
    Last Post: 03-30-2008, 11:37 AM
  4. Replies: 2
    Last Post: 02-14-2008, 02:59 PM
  5. Can't Access the private member from base class
    By planet_abhi in forum C# Programming
    Replies: 3
    Last Post: 01-09-2006, 04:30 AM