Connecting...

This is a quick preview of the lesson. For full access, please Log In or Sign up.
For more information, please see full course syllabus of C#
Bookmark & Share Embed

Share this knowledge with your friends!

Copy & Paste this embed code into your website’s HTML

Please ensure that your website editor is in text mode when you paste the code.
(In Wordpress, the mode button is on the top right corner.)
  ×
  • - Allow users to view the embedded video in full-size.
Since this lesson is not free, only the preview will appear on your website.
  • Discussion

  • Study Guides

  • Table of Contents

Lecture Comments (6)

0 answers

Post by Carl Scaglione on September 20, 2017

The C# code that was in the Exercise Files was the namespace InheritableClass.  It was topically related, but no where near the same code that was delivered in the lecture. Was this intentional?  Looks like interesting code and advanced for this lesson.  Look forward to your response.

0 answers

Post by Carl Scaglione on September 20, 2017

Followed along with your video and received unrecoverable compiler errors.  In your code, they did not appear and my code was almost identical.  When creating the methods 'public void Account() {}', public long Account(string name){ some code}, and public void Account (long ID, string name){}, I received the CS0542 code error:  'Account' member names cannot be the same as their enclosing type.  I did change the name of the methods to 'myAccount' and the problem went away, but the objective of the lesson was to show constructors which are supposed to have the same name as the class.  I am using Windows 10 and Visual Studio 2017.  This is new to me.  Do you have any thoughts?  I have followed your lectures and this is the first time that such an unresolvable error occurred.  

1 answer

Last reply by: John Snape
Sun Apr 20, 2014 3:19 AM

Post by Thuy Nguyen on April 20, 2014

I learned on Lynda.com that the return type is not part of the method signature, because C# won't know which method you want just based on the return type.  But...somehow in this lecture you can have two constructors with the same parameter list and different return types...I don't know what is the right about overloaded methods anymore now.  

Even if you can have two methods with the same parameter type but with different return values, would it be good practice to?  

1 answer

Last reply by: John Snape
Sun Apr 20, 2014 3:09 AM

Post by Thuy Nguyen on April 20, 2014

Hi, in Java, I learned that the constructor doesn't return anything, not even void.  Why would a constructor return anything in C# if it's job is to create a new object?

Understanding & Creating Classes

  • The main parts of Classes are:
    • Fields
    • Properties
    • Constructors/Destructors
    • Events
    • Methods
  • Fields are hidden from the user of your classes, and can’t be directly modified
  • Properties are directly modifiable by your class’s users
    • They can be ReadOnly or WriteOnly
    • If you only create properties without fields backing them, Visual Basic will create fields for you, but you won’t be able to access them yourself
  • Constructors create instances of your classes, Destructors destroy instances
  • Events aren’t called directly, they are called to handle specific things that happen to your class
  • Methods are called directly to change or work with data from your class
  • You can include a Class in another project by copying it to the new project, or you can create a .dll file and reference it from another project
    John Snape

    John Snape

    Understanding & Creating Classes

    Slide Duration:

    Table of Contents

    Section 1: Introduction
    Introduction Hello World

    15m 5s

    Declaring Variables

    47m 26s

    Accepting Input

    13m 17s

    Operators, Expressions and Statements

    40m 8s

    Program Flow Control

    31m 44s

    Iterations & Looping

    24m 43s

    Working with Strings

    53m 6s

    Formatting Strings for Output

    16m 24s

    Helper Methods

    28m 40s

    Enumerations & Structures

    8m 39s

    Commenting & Documenting Code

    8m 48s

    Arrays, Stacks, Queues & Dictionaries

    41m 29s

    Generic Lists & Collections

    14m 24s

    Variable Scope

    10m 38s

    Reading & Writing Files

    25m 10s

    Dates & Times

    12m 22s

    Random Numbers

    5m 29s

    Handling Exceptions

    14m 45s

    Environment Variables

    8m 21s

    Command Line Arguments

    10m 43s

    The CD Inventory Program So Far

    34m 16s

    Section 2: Object Oriented Programming
    Introduction to Object Oriented Programming

    1h 2m 20s

    Understanding & Creating Classes

    26m 6s

    Understanding Interfaces & Abstract Classes

    20m 12s

    Static vs. Instance Members

    16m 24s

    Understanding Inheritance

    32m 59s

    Understanding Polymorphism

    14m 58s

    Understanding Delegates

    22m

    Reading & Understanding Code

    35m 49s

    Creating a Data Type

    29m 21s

    Unified Modeling Language & Class Diagrams

    23m 5s

    The CD Inventory Program Upgraded with Classes

    20m 33s

    Section 3: GUI Programming
    Introduction to GUI Programming

    39m 19s

    All About Forms

    40m 7s

    Handling Form Events

    15m 22s

    Informational Controls

    27m 44s

    Command Controls

    36m 23s

    Grouping Controls

    26m 44s

    Text Editing Controls

    25m 7s

    List Selection Controls

    37m 45s

    Setting Options Controls

    21m 20s

    Dialog Controls

    22m 21s

    Graphic Display Controls

    35m 37s

    Date Setting Controls

    15m 53s

    Other Controls

    17m 33s

    Using the Clipboard

    7m 28s

    Sending Email

    25m 16s

    Some Sample Programs

    38m 31s

    Our CD Inventory Program Upgraded with Forms

    15m 16s

    Section 4: Databases
    Introduction to Databases

    34m 7s

    SQL Server Management Studio & Northwind Database

    8m 11s

    SELECT Statement

    31m 24s

    UPDATE & DELETE Statements

    16m 56s

    INSERT Statement

    11m 48s

    Creating a Database from Scratch

    44m 54s

    Querying Lists with LINQ

    20m 42s

    Using Databound Controls

    14m 22s

    Our CD Inventory Program Upgraded with a Database

    10m 50s

    Section 5: Conclusion
    Where to Go from Here

    19m 48s

    Educator®

    Please sign in to participate in this lecture discussion.

    Resetting Your Password?
    OR

    Start Learning Now

    Our free lessons will get you started (Adobe Flash® required).
    Get immediate access to our entire library.

    Membership Overview

    • Available 24/7. Unlimited Access to Our Entire Library.
    • Search and jump to exactly what you want to learn.
    • *Ask questions and get answers from the community and our teachers!
    • Practice questions with step-by-step solutions.
    • Download lecture slides for taking notes.
    • Track your course viewing progress.
    • Accessible anytime, anywhere with our Android and iOS apps.