Methods and attribute

This is a discussion on Methods and attribute within the C++ Programming forums, part of the General Programming Boards category; Hi, I wanted to know... I have an attribut for my construtor called : Code: util::Date m_openDate; I do not ...

  1. #1
    Registered User
    Join Date
    Mar 2012
    Posts
    13

    Methods and attribute

    Hi,

    I wanted to know... I have an attribut for my construtor called :

    Code:
    util::Date m_openDate;
    I do not need to access it anywhere else, only in my class.

    So I wanted to know... I don't need to make a method get to get it right?

    I can just do something like that :

    Code:
    this->m_openDate.someMethod()

    Thanks

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,421
    if only your class will be accessing it, you can either use it directly, or you can create a private getter and setter. the choice is up to you. you do not need to make public accessors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. what is PTR32 ATTRIBUTE
    By Ariyana in forum C++ Programming
    Replies: 3
    Last Post: 08-24-2011, 02:21 AM
  2. subclass attribute
    By Farnaz in forum C++ Programming
    Replies: 4
    Last Post: 03-18-2011, 02:32 PM
  3. XML Loop through attribute help
    By Striph in forum C# Programming
    Replies: 5
    Last Post: 05-07-2010, 09:01 AM
  4. Can you inherit Methods into other methods?
    By bobbelPoP in forum C++ Programming
    Replies: 5
    Last Post: 08-02-2008, 08:32 AM
  5. Read only attribute
    By earnshaw in forum C# Programming
    Replies: 1
    Last Post: 02-18-2006, 09:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21