CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2012
    Posts
    3

    help with choosing collection

    Hey, I'm new to programmering so forgive me if my questions are not well formed.

    I have been building on this rental program I found on the internet for some days. And my question is now I do I connect these classes in a good way?
    For example if I have some textboxes on my windowsform and I wanted to created a new object with some movies details and I want to put in the ID name etc of the person barrowing it and storing it in some kind of collection. Any pointers?

    Thank u

    Code:
     class Person 
        {
            private int _id;
            private string _name;
            private string _adress;
            private int _phonenr;
    
            public string UserInfo { get { return _id +  _name + _adress + _phonenr; } }
            
            public Person(int id,string name, string adress, int phonenr)
            {
                this._name = name;
                this._id = id;
                this._adress = adress;
                this._phonenr = phonenr;
            }
        }
     public class Video
        {
            private static int _numb_of_films;
            private int _year;
            private string _director;
            private string _title;
            private bool _avalible = true;
    
            public Video(string title, string director, int year)
            {
                Title = title;
                this._director = director;
                this._year = year;
                _numb_of_films++;
    
            }
            public void SetVideo(string title, string director, int year)
            {
                this._title = title;
                this._director = director;
                this._year = year;
            }
            public bool IsAvailabe(bool avalible)
            {
                _avalible = avalible;
                return this._avalible;
            }
            public bool Rented(bool rented)
            {
                _avalible = rented;
                return this._avalible;
            }
            public string VideoInfo { get { return _year + " " + _title + " " + _director; } }
    
            public static int NumOfFilms { get { return _numb_of_films; } }
            }

  2. #2
    Join Date
    Aug 2012
    Location
    Fort Collins, CO
    Posts
    2

    Re: help with choosing collection

    so are you saying you'd create a "rental", "borrow" or "checkout" object and have it hold a person and list of videos and the notes regarding that check out?

  3. #3
    Join Date
    Aug 2012
    Location
    Fort Collins, CO
    Posts
    2

    Re: help with choosing collection

    Quote Originally Posted by Magnus021 View Post
    Hey, I'm new to programmering so forgive me if my questions are not well formed.

    I have been building on this rental program I found on the internet for some days. And my question is now I do I connect these classes in a good way?
    For example if I have some textboxes on my windowsform and I wanted to created a new object with some movies details and I want to put in the ID name etc of the person barrowing it and storing it in some kind of collection. Any pointers?

    Thank u

    Code:
     class Person 
        {
            private int _id;
            private string _name;
            private string _adress;
            private int _phonenr;
    
            public string UserInfo { get { return _id +  _name + _adress + _phonenr; } }
            
            public Person(int id,string name, string adress, int phonenr)
            {
                this._name = name;
                this._id = id;
                this._adress = adress;
                this._phonenr = phonenr;
            }
        }
     public class Video
        {
            private static int _numb_of_films;
            private int _year;
            private string _director;
            private string _title;
            private bool _avalible = true;
    
            public Video(string title, string director, int year)
            {
                Title = title;
                this._director = director;
                this._year = year;
                _numb_of_films++;
    
            }
            public void SetVideo(string title, string director, int year)
            {
                this._title = title;
                this._director = director;
                this._year = year;
            }
            public bool IsAvailabe(bool avalible)
            {
                _avalible = avalible;
                return this._avalible;
            }
            public bool Rented(bool rented)
            {
                _avalible = rented;
                return this._avalible;
            }
            public string VideoInfo { get { return _year + " " + _title + " " + _director; } }
    
            public static int NumOfFilms { get { return _numb_of_films; } }
            }
    Are you talking about having a "rental" object that holds a person and a list of movies?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured