Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help a noob with inheritance

 
Ben Alex Barreto
Greenhorn
Posts: 15
Java Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I've been trying to learn Objective-C, and yesterday I was looking at how inheritance works.

I created two classes, Person and Employee. The later is supposed to inherit from Person. The problem is that I'm getting this error "No visible @inerface for Employee" when I try to instantiate an Employee and set its weightInKilos or heightInMeters. Here are the header and implementation files:






And here is the main


I'm just trying to learn. What am I doing wrong?
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I copied your code and run it with a flying colors without any error.

Do you a duplicated file here and there (such as Person.h/Person.m/Employee.h/Employee.m) ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic